I am making a script that is supposed to kick a player if they are not an admin and they are using a tool with a specific name. However, it is not working and not even printing "Activated" when a new child is added. Please help! Script:
local Admins = {"TheLastHabanero","jetmitenClone","CinnamonBunRoller"} local BannedTools = {"Building Tools","BuildingTools","Delete","Copy","Fly","Noclip"} game.Players.PlayerAdded:Connect(function(Player) local Human = Player.Character:FindFirstChild("Humanoid") Human.Parent.ChildAdded:Connect(function(thing) print("Activated") local Admin = false for i, player in pairs(Admins) do if Player.Name == player then print("Player is admin!") Admin = true end end if Admin == false then print("Not an Admin...") for i, tool in pairs(BannedTools) do if thing.Name == tool then Player:Kick("Using Banned Tools WIthout Permission") end end end) end)
Your script was running before the player actually loaded and you also forgot to write end for one of the if-statements
local Admins = {"TheLastHabanero","jetmitenClone","CinnamonBunRoller"} local BannedTools = {"Building Tools","BuildingTools","Delete","Copy","Fly","Noclip"} game.Players.PlayerAdded:Connect(function(Player) local char = Player.Character or Player.CharacterAdded:Wait() local Human = char:FindFirstChild("Humanoid") Human.Parent.ChildAdded:Connect(function(thing) print("Activated") local Admin = false for i, player in pairs(Admins) do if Player.Name == player then print("Player is admin!") Admin = true end end if Admin == false then print("Not an Admin...") for i, tool in pairs(BannedTools) do if thing.Name == tool then Player:Kick("Using Banned Tools WIthout Permission") end end end end) end)