Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do I make a player only respawn if they own a gamepass?

I am making a game where only people who own the ForLag gamepass can respawn and others who don't own the gamepass will be teleported to another game here is the script I have so far written (I don't know what to write for the second varible)

local gamepass_id = 9976637 local can_respawn =

game.Players.LocalPlayer.Character:WaitForChild('Humanoid').Died:connect(function()

game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId,gamepass_id) then local can_respawn = true

1 answer

Use code blocks.

local Gamepass_ID = 9976637
local Can_Respawn = false
local Player = game.Players.LocalPlayer
local MarketplaceService = game:GetService("MarketplaceService")

Player.CharacterAdded:Connect(function(Character)
    local Humanoid = Character:WaitForChild("Humanoid")
    Humanoid.Died:Connect(function()
    if MarketplaceService:UserOwnsGamePassAsync(Player.UserId, Gamepass_ID) == true then
         Can_Respawn = true

         end
    end)
end

This discussion is preserved as it was. New answers, comments, and votes are closed.