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

Script that kicks players with boots not working?

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)

1 answer

✓ Accepted answer

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)

3 comments

0

Thanks! Ill see if it works.

0

If it works, Ill accept your answer

0

If it works, Ill accept your answer

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