So i have a tool that kicks players but i dont want it too kick players in a list i have
local Tool = script.Parent
local Allowed = {"Tunnells","OFFICIAL_HACK1","beast29man","amazing40078","Player1"}
local Module = require(Tool:WaitForChild("Setting"))
local can, onAnimation = true, false
if Module.IdleAnimationID ~= nil or Module.DualEnabled then
local IdleAnim = Instance.new("Animation",Tool)
IdleAnim.Name = "IdleAnim"
IdleAnim.AnimationId = "rbxassetid://"..Module.IdleAnimationID
end
if Module.HitAnimationID ~= nil then
local HitAnim = Instance.new("Animation",Tool)
HitAnim.Name = "HitAnim"
HitAnim.AnimationId = "rbxassetid://"..Module.HitAnimationID
end
local Players = game:GetService("Players")
function unEquipItems() script.Parent.Parent = Players:GetPlayerFromCharacter(script.Parent.Parent).Backpack end
script.Damage.OnServerEvent:Connect(function(plr,tipe)
if tipe then
if tipe == 0 then
onAnimation = true
else
onAnimation = false
end
end
end)
script.Parent.Handle.Touched:Connect(function(hit)
local Players = game:GetService("Players")
if hit.Parent:FindFirstChild("Humanoid") and hit.Parent.Name ~= script.Parent.Parent.Name and hit.Parent.Humanoid.Health > 0 and can and onAnimation then
can = false
local TargetPlayer = Players:GetPlayerFromCharacter(hit.Parent)
if TargetPlayer then
for _,v in pairs(Allowed) do
if TargetPlayer.Name == v then
print("NO LOL")
else
TargetPlayer:Kick("You have been hit by a overpowered weapon O_O")
spawn(function() wait(.5) can = true end)
end
end
end
end)
while wait(.1) do
if script.Parent.Parent.Name ~= "Backpack" and script.Parent.Parent:FindFirstChild("Humanoid") and script.Parent.Parent.Humanoid.Sit == true then unEquipItems() end
end
```
Im guessing that allowed is people that can’t get kicked by the tool.
local Tool = script.Parent
local Allowed = {"Tunnells","OFFICIAL_HACK1","beast29man","amazing40078","Player1"}
local Module = require(Tool:WaitForChild("Setting"))
local can, onAnimation = true, false
if Module.IdleAnimationID ~= nil or Module.DualEnabled then
local IdleAnim = Instance.new("Animation",Tool)
IdleAnim.Name = "IdleAnim"
IdleAnim.AnimationId = "rbxassetid://"..Module.IdleAnimationID
end
if Module.HitAnimationID ~= nil then
local HitAnim = Instance.new("Animation",Tool)
HitAnim.Name = "HitAnim"
HitAnim.AnimationId = "rbxassetid://"..Module.HitAnimationID
end
local Players = game:GetService("Players")
function unEquipItems() script.Parent.Parent = Players:GetPlayerFromCharacter(script.Parent.Parent).Backpack end
script.Damage.OnServerEvent:Connect(function(plr,tipe)
if tipe then
if tipe == 0 then
onAnimation = true
else
onAnimation = false
end
end
end)
script.Parent.Handle.Touched:Connect(function(hit)
local Players = game:GetService("Players")
if hit.Parent:FindFirstChild("Humanoid") and hit.Parent.Name ~= script.Parent.Parent.Name and hit.Parent.Humanoid.Health > 0 and can and onAnimation then
can = false
local TargetPlayer = Players:GetPlayerFromCharacter(hit.Parent)
if not table.find(Allowed,TargetPlayer.Name) then
TargetPlayer:Kick("You have been hit by a overpowered weapon O_O")
end
end
end)
while wait(.1) do
if script.Parent.Parent.Name ~= "Backpack" and script.Parent.Parent:FindFirstChild("Humanoid") and script.Parent.Parent.Humanoid.Sit == true then unEquipItems() end
end
You can get the table of admin, that’s what your list is I assume, so for example local playersToNotKick = {1,2,3,4}
(use UserIds of the players so if they change their name it won’t break)
Then you can use table.find to check if there’s a player in the list.
if not table.find(playersToNotKick,TargetPlayer.UserId) then
TargetPlayer:Kick("ha get kicked")
end
basically that says, if the script can’t find the player’s userid in the list of userids not to kick, then you can kick them!
local Tool = script.Parent
local Allowed = {"Tunnells","OFFICIAL_HACK1","beast29man","amazing40078","Player1"}
local Module = require(Tool:WaitForChild("Setting"))
local can, onAnimation = true, false
if Module.IdleAnimationID ~= nil or Module.DualEnabled then
local IdleAnim = Instance.new("Animation",Tool)
IdleAnim.Name = "IdleAnim"
IdleAnim.AnimationId = "rbxassetid://"..Module.IdleAnimationID
end
if Module.HitAnimationID ~= nil then
local HitAnim = Instance.new("Animation",Tool)
HitAnim.Name = "HitAnim"
HitAnim.AnimationId = "rbxassetid://"..Module.HitAnimationID
end
local Players = game:GetService("Players")
function unEquipItems() script.Parent.Parent = Players:GetPlayerFromCharacter(script.Parent.Parent).Backpack end
script.Damage.OnServerEvent:Connect(function(plr,tipe)
if tipe then
if tipe == 0 then
onAnimation = true
else
onAnimation = false
end
end
end)
script.Parent.Handle.Touched:Connect(function(hit)
local Players = game:GetService("Players")
if hit.Parent:FindFirstChild("Humanoid") and hit.Parent.Name ~= script.Parent.Parent.Name and hit.Parent.Humanoid.Health > 0 and can and onAnimation then
can = false
local TargetPlayer = Players:GetPlayerFromCharacter(hit.Parent)
if not table.find(Allowed,TargetPlayer.Name) then
TargetPlayer:Kick("You have been hit by a overpowered weapon O_O")
end
end
end)
while wait(.1) do
if script.Parent.Parent.Name ~= "Backpack" and script.Parent.Parent:FindFirstChild("Humanoid") and script.Parent.Parent.Humanoid.Sit == true then unEquipItems() end
end
``` i know i will one day change it too userids xd but this doesnt work
I would loop through the Players list in server, then make a separate array and use table.insert() to add that player to the array let’s call it “NoKickArray” and then after the loop is done, you would loop through players again and if their name is found in NoKickArray (loop through this array for every player) then DO NOT kick.