This game pass script is connected to a GUI text button and the function of it is to change the players profession to Bank Staff if they have the game pass and it seems not to change my profession and yes it is in a LocalScript! If someone could help fix the script and explain what I did wrong that would be helpful.
local player = game:GetService("Players").LocalPlayer
local GamePassService = game:GetService('GamePassService')
local GamePassId = 416231639
function Good()
if GamePassService:PlayerHasPass(player, GamePassId) then
player.leaderstats.WantedLevel.Value = 0
player.leaderstats.Profession.Value = "Bank Staff"
script.Parent.Parent.Parent.AppliedGood.Visible = true
script.Parent.Parent.Visible = false
else script.Parent.Parent.Parent.AppliedError.Visible = true
script.Parent.Parent.Visible = false
end
end
script.Parent.MouseButton1Down:connect(Good)

3 comments
I'd avoid doing this in a LocalScript.
Alright I tried still dont work
gamepassservice is depreciated. use marketplaceservice. http://wiki.roblox.com/index.php?title=API:Class/MarketplaceService/PlayerOwnsAsset