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

I need help on this script please help?

Asked by 10 years ago
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!

3 answers

Log in to vote
0
Answered by
lomo0987 250 Moderation Voter
10 years ago
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.

Ad
Log in to vote
1
Answered by
hiccup111 231 Moderation Voter
10 years ago

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.

Log in to vote
-4
Answered by 10 years ago
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.

Answer this question