Basically, I am having trouble with my gamepass run perk. The user buys it in game, they reset and boom the GUI should appear. So you'd think, but it doesn't. It works in Studio, but when the person who owns the gamepass leaves and re-joins the game, the GUI doesn't appear, same goes for when they reset. I'll post my script so hopefully one of you good fellow Roblox'ers can help.
game.Players.PlayerAdded:Connect(function(player) player.CharacterAdded:Connect(function(character) if game.MarketplaceService:PlayerOwnsAsset(player,996728468) then character.Humanoid.WalkSpeed = 75 game.Players.LocalPlayer.PlayerGui.NoticeGUI.Note.Visible = true game.Players.LocalPlayer.PlayerGui.ScreenGui.Run.Visible = true game.Players.LocalPlayer.PlayerGui.ScreenGui.Walk.Visible = true game.Players.LocalPlayer.PlayerGui.ScreenGui.TextButton.Visible = false end end) end)
Thanks for your time and I hope you can help me out.
You need to use PlayerHasPass
instead of PlayerOwnsAsset
. But keep in mind PlayerHasPass
is server side only, so it should not go in a localscript.
local id = 103728213 --id here game.Players.PlayerAdded:connect(function(player) player.CharacterAdded:Connect(function(character) if game:GetService("GamePassService"):PlayerHasPass(player, id) then character.Humanoid.WalkSpeed = 75 player.PlayerGui:WaitForChild("NoticeGUI").Note.Visible = true player.PlayerGui:WaitForChild("ScreenGui").Run.Visible = true player.PlayerGui:WaitForChild("ScreenGui").Walk.Visible = true player.PlayerGui:WaitForChild("ScreenGui").TextButton.Visible = false else --Do whatever here end end) end)
Wiki page. Hopefully this worked for you, if it did please accept my answer! Thanks!