Well I've already asked this a while ago somewhere else, but I still don't really have an answer that worked. I know it's probably pretty simple, but if anyone can help me with this, I'd appreciate it.
How can I create a block that kicks people who touch it?
2 answers
Zottorus, just use the :Kick() method like this:
script.Parent.Touched:Connect(function(hit)
if game.Players:FindFirstChild(hit.Parent.Name) and hit.Parent:IsA("Model") then
game.Players[hit.Parent.Name]:Kick("HAHAHAHAHA")
end
end)
2 comments
I do not recommend that method since if an accessory touched the part it will not return the character's name.
i changed it so it cant mess up with accessories
local part = script.Parent --locate yours by your own
part.Touched:Connect(function(hit) local hum = hit.Parent:FindFirstChild("Humanoid") or hit.Parent.Parent:FindFirstChild("Humanoid") --getting the humanoid local char = hum.Parent --getting the character local plr = game.Players:GetPlayerFromCharacter(char) --getting the player from the cahracter wait() if plr then plr:Kick("insert reason of kick here") --kicking the player end end)
2 comments
anything with a humanoid can get kicked and you didnt put a end
^ :GetPlayerFromCharacter(char) gets the player from the character, if there isn't a player it will return nil. I modified the script and added an if just to make sure there is a player.
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
Use a touch event. Make an attempt if you need help. This isn't a site where you ask for scripts.