Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Game pass is broken last 1 life only. Help?

Asked by 5 years ago

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

Log in to vote
0
Answered by 5 years ago

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)
0
Where do I keep the first script and where do I keep my gui? mynameidmk 40 — 5y
0
I'd recommend putting the first script inside StarterCharacterScript and put the GUI in ReplicatedStorage SuperSamyGamer 316 — 5y
Ad

Answer this question