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

Why does this script only work in a normal script and not local scripts?

This script only works in normal scripts. It doesn't work in local scripts for some reason. Somebody please help.

here is the script:

game.Players.PlayerAdded:connect(function(Player)
    local rank = Player:GetRankInGroup(4070429)
    if rank == 255 or rank == 224 then
        print("sdfghjuhgfdfgh")
    end
end)

Thanks

1 comment

0

PlayerAdded can only be used in a server script.

1 answer

✓ Accepted answer
local plr = game.Players.LocalPlayer

local rank = Player:GetRankInGroup(4070429)
if rank == 255 or rank == 224 then
    print("sdfghjuhgfdfgh")
end

Would be the way to use it in a localscript. Personally I don't recommend it because hackers can change it and get access to your rank stuffs even if your game is FE.

Localscripts are the client scripts of a player, so PlayerAdded will not work here. Although you could get past this with using ChildAdded instead. :P

3 comments

0

Thanks. How could I stop hackers from changing their ranks?

0

I'll DM you a model later, so you can do it securely.

0

Don't worry about it. I found a way around that.

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