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

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

Asked by 6 years ago
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
0
or "Staff Card" will always return true, you need to do if item.Name == "Cuffs" or item.Name == "Staff Card" then Vulkarin 581 — 6y
0
Usually I can work around that but thank you. VeryDarkDev 47 — 6y
0
no problem Vulkarin 581 — 6y

2 answers

Log in to vote
0
Answered by 6 years ago

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
Ad
Log in to vote
0
Answered by 6 years ago

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.

Answer this question