Basically i want a tool to kick players but if the player is in a table it wont
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 ipairs(Allowed) do
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
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
return end
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
But this will allow only the players that are in the table, as i understood he wants to make a system that doesen’t kick the players in the table so @Tunnells you could try this:
if not table.find(allowed, TargetPlayer) then
TargetPlayer:Kick()
end
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
``` late reply i know lol