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

How can I make someone take damage from click detector when they press a object?

Asked by 2 years ago

How can I make someone take damage from click detector when they press a object?

1 answer

Log in to vote
0
Answered by
NykoVania 231 Moderation Voter
2 years ago

This should work.

local clickDetector = script.Parent

local function onClicked(player)
    player.Character.Humanoid.Health -= 10
end

clickDetector.MouseClick:Connect(onClicked)
Ad

Answer this question