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

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

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

✓ Accepted answer

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)

1 comment

0

What?

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)

2 comments

0

actually you want to say plr.Name ~= blah and, not or

0

yeah was more focused on fixing his actual statement and didn't notice the error. Thanks for the fix.

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