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

Why won't this script work?

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

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. ultimate055 150 — 9y

1 answer

Log in to vote
0
Answered by
Shawnyg 4330 Trusted Badge of Merit Snack Break Moderation Voter Community Moderator
9 years ago

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
Ad

Answer this question