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

How do I add a line to this script where it deals damage on click?

Asked by 10 years ago

Somebody helped me get this script yesterday, and now I need it to deal 10 damage (once per time clicked) when it pops up. Try to understand? If you cant, please tell me and I'll try to explain further. Anyways, here's what I've got so far..

script.Parent.ClickDetector.MouseClick:connect(function(p)
repeat wait(1/30) until p.PlayerGui
p.PlayerGui.ScreenGui1.YouFoundACrab.Visible = true
-- I think it should go here, but not sure what..
game.Workspace.Ouch:Play()
wait(10)
p.PlayerGui.ScreenGui1.YouFoundACrab.Visible = false
end)

I'd appreciate it if you helped :3

0
Does it have health, and if it does, how did you give it health? That'll tell me what you need to do to subtract the damage. GoldenPhysics 474 — 10y
0
I dont really understand your question, but It's just a player, normal health. SchonATL 15 — 10y

1 answer

Log in to vote
0
Answered by
lomo0987 250 Moderation Voter
10 years ago

You haven't told us what you are trying to deal damage to. But considering the text.. It's a crab. So I will try to make it so it works based on what you have provided me with.

script.Parent.ClickDetector.MouseClick:connect(function(p)
local a = p.Character.Humanoid.Health
repeat wait(1/30) until p.PlayerGui
p.PlayerGui.ScreenGui1.YouFoundACrab.Visible = true
a = a - 10
game.Workspace.Ouch:Play()
wait(10)
p.PlayerGui.ScreenGui1.YouFoundACrab.Visible = false
end)

I believe this should work based on what you have provided me. In anyways... this should be located within the part of the crab. The humanoid should also be located within the model of the crab.

0
Im trying to deal damage to a player. Could you just configure your answer real quick for me? SchonATL 15 — 10y
0
You want it to hurt the player? Okay, I set it up so it should work fine now. lomo0987 250 — 10y
Ad

Answer this question