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

Why this LocalScript don't work?

Asked by 10 years ago
local Badge = (IDhidden)

function onNewPlayerEntered(newPlayer) 
    if game:GetService("BadgeService"):UserHasBadge(newPlayer.userId, Badge) then
        game.Players.LocalPlayer.PlayerGui.SG.SF.B1.Check.Visible = true
    else return end 
end 

game.Players.PlayerAdded:connect(onNewPlayerEntered)

Basically this LocalScript makes a image visible if the user has the badge but it doesn't work.. im just a basic scripter, i don't know what may be wrong, i've changed alot of things in the code but it still don't work.

Heres the StarterGui :

http://imgur.com/6RYRctE

pls help :c

1 answer

Log in to vote
1
Answered by
BlueTaslem 18071 Moderation Voter Administrator Community Moderator Super Administrator
10 years ago

You can't use services like the BadgeService from a LocalScript -- read the Wiki!.

Switch to using a normal Script.

I'm not sure why you're using both the LocalPlayer and PlayerAdded. You probably just want the "local player" (except that from a regular Script you can't use LocalPlayer and will just use the appropriate script.Parent.Parent.Parent etc)

0
I changed it to a regular script, I've changed a few things but it still don't work. I posted another question.... brickgame38 50 — 10y
Ad

Answer this question