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

Gamepass script not working?

Asked by 8 years ago

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)
2
I'd avoid doing this in a LocalScript. User#6546 35 — 8y
0
Alright I tried still dont work Dark_Dimensions 96 — 8y
0
gamepassservice is depreciated. use marketplaceservice. http://wiki.roblox.com/index.php?title=API:Class/MarketplaceService/PlayerOwnsAsset LostPast 253 — 8y

1 answer

Log in to vote
1
Answered by 8 years ago
function Good()
if game.MarketplaceService:PlayerOwnsAsset(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
Ad

Answer this question