local PassId = 39937164
game.Players.PlayerAdded:connect(function(p)
if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(p.UserId, PassId) then
p.PlayerGui.TeamChange.Main.AvailableTeams.Visible = true
end
p.CharacterAdded:Connect(function()
p.PlayerGui:WaitForChild("TeamChange"):WaitForChild("Main"):WaitForChild("AvailablrTeams").Visible = true
end)
end)
How would I make this work? This is a serverscript in SSS.
wait i dont understand you want a gamepass that you can buy but its only for the owner???
btw please for the love of god create variables for services
local PassId = 39937164
local mpService = game:GetService("MarketplaceService")
local plrService = game:GetService("Players")
plrService.PlayerAdded:connect(function(p)
if mpService:UserOwnsGamePassAsync(p.UserId, PassId) then
p.PlayerGui.TeamChange.Main.AvailableTeams.Visible = true
end
p.CharacterAdded:Connect(function()
p.PlayerGui:WaitForChild("TeamChange"):WaitForChild("Main"):WaitForChild("AvailablrTeams").Visible = true
end)
end)
After the marketplaceservice try adding a == true but not sure, then you probably should add onto the gui the property resetonspawn or something like that as that clears all guis that don’t have it
Trying actually waiting for the gui loads as soon as the player joins…
local PassId = 39937164
local mpService = game:GetService("MarketplaceService")
local plrService = game:GetService("Players")
plrService.PlayerAdded:connect(function(p)
if mpService:UserOwnsGamePassAsync(p.UserId, PassId) then
p:WaitForChild("PlayerGui"):WaitForChild("TeamChange"):WaitForChild("Main"):WaitForChild("AvailableTeams").Visible = true
end
p.CharacterAdded:Connect(function()
p.PlayerGui:WaitForChild("TeamChange"):WaitForChild("Main"):WaitForChild("AvailableTeams").Visible = true
end)
end)