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

Game pass is broken last 1 life only. Help?

I made a gamepass that if you buy it you get a teleport gui. For some reason tho it only lasts 1 life. If I die it goes away. I need it to stay forever tho. Here is script:

local id = 6341684

game.Players.PlayerAdded:Connect(function(plr)

plr.CharacterAdded:connect(function(char)

if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(game.Players[char.Name].UserId, id) then

local ui = script.Teleport:Clone()

ui.Parent = plr.PlayerGui

end

end)

end)

I put the gui inside of this script and it last 1 life tho. I need it to last forever. Please help.

1 answer

Make a script containing something like this inside a server script

Character.Humanoid.Died:Connect(function()
    if game:GetService(“MarketplaceService”):UserOwnsGamePassAsync(game.Players[[char.Name](http://char.name/)].UserId, 6341684) then
		RemoteEventPathHere.RemoteEvent:FireClient(game.Players:GetPlayerFromCharacter(Character))
	end
end

and then make a local script in StarterGui containing something like this

local plr = game.Players.LocalPlayer
RemoteEventPathHere.RemoteEvent.OnClientEvent(function()
    local ui = script.Teleport:Clone()
    ui.Parent = plr.PlayerGui
end)

2 comments

0

Where do I keep the first script and where do I keep my gui?

0

I'd recommend putting the first script inside StarterCharacterScript and put the GUI in ReplicatedStorage

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