I’m making a game pass that allows you to see a curtain gui. It works fine, until 2 people are in the server that owns the gamepass. Also, when you die the gui disappears. Here’s the script:
local PassId = 11379241
game.Players.PlayerAdded:connect(function(p)
if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(p.UserId, PassId) then
game.StarterGui.speed.Frame.Visible = not game.StarterGui.speed.Frame.Visible
end
end)
Here is what it looks like in studio:
I assume it’s this line:
game.StarterGui.speed.Frame.Visible = not game.StarterGui.speed.Frame.Visible
When you make a change to game.StarterGui the changes are universal, therefore if speed.Frame is Visible = false by default, by the time the second player joins you will have done a full cycle. Lets make some small edits to your code to make it more versatile.
local PassId = 11379241
game.Players.PlayerAdded:connect(function(p)
if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(p.UserId, PassId) then
p.PlayerGui.speed.Frame.Visible = true
else
return
end
p.CharacterAdded:Connect(function()
p.PlayerGui:WaitForChild("speed"):WaitForChild("Frame").Visible = true
end)
end)
All we’re doing is having this target only the player, preventing the gui from cycling back to false, and preventing the gui from resetting when the player dies.
I edited my original reply with an alternative solution to the matter, could you test that out and report back - reverting the settings back to normal could also be beneficial.