Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-1

kill when stop function help?

Asked by 10 years ago

how wold i make in this have also add when you stop it kills you?

local debounce = false 

function onTouch(part) 

local human = part.Parent:findFirstChild("Humanoid") 
if (human ~= nil) and debounce == false then 

debounce = true 

human.WalkSpeed = 50
wait(2) 
debounce = false 
end 
end 


script.Parent.Touched:connect(onTouch) 

1 answer

Log in to vote
-1
Answered by 10 years ago
local debounce = false 

script.Parent.Touched:connect(function(hit)

if not debounce then

debounce = true

local getPlayer = game.Players:GetPlayerFromCharacter(hit.Parent)
local findPlayer = game.Workspace:FindFirstChild(player.Name)

findPlayer.Humanoid.Health = 0

debounce = false

end

end)

The script above kills the player when they touch it. Not exactly sure what else you need because I don't understand what you typed. If this script doesn't work, let me know.

Ad

Answer this question