local passid = 157704756 local GamePassService = Game:GetService("GamePassService") local character = player.Character if GamePassService:PlayerHasPass(player, passid) then print("Human passed test") else script.Parent:remove() end
I want to make it work if the player has the gamepass , the gui will show to them. if they dont have the gamepass then it won't show. please help me i need it!
local passid = 157704756 local GamePassService = Game:GetService("GamePassService") local character = player.Character local player = game.Players.LocalPlayer -- forgot to say who the player is. if GamePassService:PlayerHasPass(player, passid) then print("Human passed test") else script.Parent:Remove() -- Forgot to Cap the R in remove. end
I believe this should work. If not please let me know.
First thing, is this a LocalScript?
If so, to get the local player fast:
local player = game.Players.LocalPlayer -- Your player
Then you can get your Character, etc.
local passid = 157704756 local GamePassService = Game:GetService("GamePassService") local player = local player local character = player.Character if GamePassService:PlayerHasPass(player, passid) then print("Human passed test") else script.Parent:remove() end
You forgot to define player.