*(\/)@Si*
Мыслитель
(6318)
2 месяца назад
```python
gamepad_purchased = True # установите для этой переменной значение True, если куплен геймпас, в противном случае установите значение False
if gamepad_purchased:
print("Геймпас куплен. Игрок оживёт при прикосновении блока.")
else:
print("Геймпас не куплен. Игрок будет удалён с сервера, если коснётся блока.")
Егор
Знаток
(310)
2 месяца назад
Here's an example script for a game in Roblox that includes a gamepass purchase for reviving the player when they die. The script assumes that there is a block in the game that, when touched, kills the player:
"""
-- Get references to the necessary objects
local block = game.Workspace.Block
local player = game.Players.LocalPlayer
local playerRespawn = game.Workspace.PlayerRespawn
local gamepass = game:GetService("GamePassService"):GetProductInfo(gamepassID)
-- Define the gamepass ID for the revive gamepass
local gamepassID = 12345678
-- Function to handle player death
local function onPlayerDeath()
-- Check if the player has purchased the revive gamepass
if player:FindFirstChild("ReviveGamepass") then
-- Revive the player at the playerRespawn location
player.Character.Humanoid.Health = player.Character.Humanoid.MaxHealth
player.Character:SetPrimaryPartCFrame(playerRespawn.CFrame)
else
-- Kick the player off the server
player:Kick("You did not purchase the revive gamepass!")
end
end
-- Function to handle when the block is touched
local function onBlockTouch(other)
if other == player.Character then
-- Kill the player
player.Character.Humanoid.Health = 0
wait(5) -- Wait for 5 seconds to give the death animation time to play
onPlayerDeath() -- Handle the player's death
end
end
-- Connect the block's touch event to the onBlockTouch function
block.Touched:Connect(onBlockTouch)
"""
In this script, the gamepassID variable is set to the ID of the gamepass that can be purchased to revive the player. When the block is touched, the onBlockTouch function is called and checks if the player has the revive gamepass. If they do, the onPlayerDeath function revives the player at a predefined respawn location. If they don't have the gamepass, the onPlayerDeath function kicks the player off the server.
Note that this script assumes that the revive gamepass has been created in the Roblox studio and assigned the ID gamepassID. The GamePassService object is used to retrieve information about the gamepass, and the player:FindFirstChild function is used to check if the player has purchased the gamepass. If the gamepass does not exist or the ID is incorrect, the script will not function correctly.
Если куплен геймпас то игрок просто возрождается
иначе его кикает с сервера