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

why does my kick script kick me and not work? My name and everything is correct

Asked by 6 years ago

So I posted this already but then the last one I didn't really know how to correctly use if statements so heres the fixed script

game.Players.PlayerAdded:Connect(function(plr)
    if plr.Name ~= 'Halmuni' or plr.Name ~= 'Unholy_God' then
    plr:Kick()

    end
end)

0
change or to and. oftenz 367 — 6y
0
Didn't notice this on my previous answer sorry! oftenz 367 — 6y
0
^, no what are you talking about User#23365 30 — 6y
0
the and operator will return truthy if both of the conditions are true User#23365 30 — 6y
View all comments (7 more)
0
the or operator will return truthy if either of the conditions are true User#23365 30 — 6y
0
Do you want to kick yourself or people that aren't yourself? one23four56 20 — 6y
0
@EXpodo1234ALT What are you talking about? He's wanting to kick people not named Halmuni/Unholy_God oftenz 367 — 6y
0
try using "and" instead of "or" greatneil80 2647 — 6y
0
how are you using te script (server sided, localscript, script, ect.) ? danglt 185 — 6y
0
I just realized it says if (your name) joins it will kick you. That is what the script is telling it to do danglt 185 — 6y
0
Server script User#22788 5 — 6y

2 answers

Log in to vote
0
Answered by
danglt 185
6 years ago
game.Players.PlayerAdded:Connect(function(plr)
    if plr.Name ~= 'Halmuni' or plr.Name ~= 'Unholy_God' then
    print "safe"
end
end)


if plr.Name ~= ~= 'Halmuni' or plr.Name ~= 'Unholy_God' == false then
    plr:Kick()
end
Ad
Log in to vote
0
Answered by 6 years ago
local Whitelist = {'Halmuni','Unholy_God'}

game.Players.PlayerAdded:Connect(function(Player)
    for _,v in pairs(Whitelist) do
        if Player.Name ~= v then
            Player:Kick("Not in whitelist")
        end
    end
end)

Answer this question