RobloxScripterAI
Discord ↗
Link Copied to Clipboard
×
"my part will follow players and if it touches a player it will do 25 damage"
local debounce = false local function onTouch(Touch) if game.Players:GetPlayerFromCharacter(Touch.Parent) then print("Damage player due to touch") if Touch.Parent:FindFirstChild("Humanoid") ~= nil then if not debounce then debounce = false Touch.Parent.Humanoid.Health = Touch.Parent.Humanoid.Health - 25 wait(1) debounce = false end end else print("Was trying to damage an NPC, it was blocked.") end end script.Parent.Touched:Connect(onTouch)