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

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

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)
	

11 comments

0

change or to and.

0

Didn't notice this on my previous answer sorry!

0

^, no what are you talking about

0

the and operator will return truthy if both of the conditions are true

0

the or operator will return truthy if either of the conditions are true

0

Do you want to kick yourself or people that aren't yourself?

0

@EXpodo1234ALT What are you talking about? He's wanting to kick people not named Halmuni/Unholy_God

0

try using "and" instead of "or"

0

how are you using te script (server sided, localscript, script, ect.) ?

0

I just realized it says if (your name) joins it will kick you. That is what the script is telling it to do

0

Server script

2 answers

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
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)

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