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

Script that kicks players with boots not working?

Asked by
haba_nero 386 Moderation Voter
4 years ago

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

Log in to vote
1
Answered by
synkrio 281 Moderation Voter
4 years ago

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)

0
Thanks! Ill see if it works. haba_nero 386 — 4y
0
If it works, Ill accept your answer haba_nero 386 — 4y
0
If it works, Ill accept your answer haba_nero 386 — 4y
Ad

Answer this question