local KickMessage = 'Kicked by an admin.' script.Parent.Handle.Touched:connect(function(hit) if hit.Parent:FindFirstChild('Humanoid') then local Player = game:GetService('Players'):GetPlayerFromCharacter(hit.Parent) while true do wait() Player:Kick() end end end)
Is there anyway to make this work? It's suppose to loop kick the player when hit by the tool.
You gotta use a thread every time you ban someone so like this:
local KickMessage = 'Kicked by an admin.' script.Parent.Handle.Touched:Connect(function(hit) if hit.Parent:FindFirstChild('Humanoid') then local Player = game:GetService('Players'):GetPlayerFromCharacter(hit.Parent) spawn(function() while true do wait() if game.Players:FindFirstChild(player) then Player:Kick(KickMessage) end end end) end end)
So as you see, spawn(function() is a separate thread that lets the while true do run for ever without yielding the script.
If this doesn't work, tell me in the comments, enjoy and if it worked, accept this answer :D
Also, you might ban yourself if you do this so, rip.