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

This script is supposed to kick a player only if they do something but it kicks them every time?

local item = player.Character:FindFirstChild(item)
if item.Name == "Cuffs" or "Staff Card" then
	player:Kick("Do not give other players rank tools.")
else
	item.Parent = game.Players[target].Backpack
end

3 comments

0

or "Staff Card" will always return true, you need to do if item.Name == "Cuffs" or item.Name == "Staff Card" then

0

Usually I can work around that but thank you.

0

no problem

2 answers

On line 2 you need to add another "item.Name ==" after the 'or'.

local item = player.Character:FindFirstChild(item)
if item.Name == "Cuffs" or item.Name == "Staff Card" then
    player:Kick("Do not give other players rank tools.")
else
    item.Parent = game.Players[target].Backpack
end

There is also another issue surrounding this security system. Since you are looking into the Player's Character Model for the items, you will not be able to kick them until they have equipped the Cuffs or Staff Card. Therefore I would recommend auto-equipping items right after giving them, and this will prevent "corrupt guards" from passing it on further without your realization.

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