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

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

Asked by
Faazo 84
6 years ago

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

0
PlayerAdded can only be used in a server script. GingeyLol 338 — 6y

1 answer

Log in to vote
1
Answered by 6 years ago
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

0
Thanks. How could I stop hackers from changing their ranks? Faazo 84 — 6y
0
I'll DM you a model later, so you can do it securely. MachoPiggies 526 — 6y
0
Don't worry about it. I found a way around that. Faazo 84 — 6y
Ad

Answer this question