Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why won't this script work?

gamepassid=157704758
local player = Player.Character
while true do
if game:GetService("GamePassService"):PlayerHasPass(player,gamepassid)then
script.Parent.Visible = true
else 
script.Parent.Visible = false
end
end

i'm trying to make it if you have the gamepass then it appears or if you don't it disapears

1 comment

0

Line 2. That line doesn't tell the script where the Character is. Is this a restricted door? If so add a ontouched function and make hit.Parent the character.

1 answer

✓ Accepted answer

There's no need for a while loop in this case. You can just set the Local Player using a LocalScript.

gamepassid=157704758
player = game.Players.LocalPlayer
if game:GetService("GamePassService"):PlayerHasPass(player,gamepassid) then
	script.Parent.Visible = true
else
	script.Parent.Visible = false
end

This discussion is preserved as it was. New answers, comments, and votes are closed.