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

Why won't this script work I put everything right including the name?

Asked by 6 years ago
game.Players.PlayerAdded:Connect(function(plr)
    if plr.Name ~= 'Halmuni' or 'Aclysmic' then
        plr:Kick()

    end
end)

so basically when a player joins if name is not equal to 'Halmuni' or 'Aclysmic' it will kick but it kicks me...... and I think it kicks the other parameter too

2 answers

Log in to vote
1
Answered by
Shadrz 40
6 years ago
Edited 5 years ago

Wrap it in parenthesis, it should work. This allows for more efficient code.

game.Players.PlayerAdded:Connect(function(plr)
    if plr.Name == ('Halmuni' or 'Aclysmic') then
        plr:Kick()
    end
end)
0
What? User#19524 175 — 6y
Ad
Log in to vote
1
Answered by
oftenz 367 Moderation Voter
6 years ago

You are not using if statements correctly. Here is fixed code:

game.Players.PlayerAdded:Connect(function(plr)
    if plr.Name ~= "Halmuni" or plr.Name ~= "Aclysmic" then
        plr:Kick()
    end
end)
0
actually you want to say plr.Name ~= blah and, not or User#19524 175 — 6y
0
yeah was more focused on fixing his actual statement and didn't notice the error. Thanks for the fix. oftenz 367 — 6y

Answer this question