Kill brick problems

Back
WEX
Join Date:
Posts:
Dec 2023
10
1 month ago | 19 • By WEX

I need help:


My script is - - -


script.Parent.Touched:Connect(function(collision)
if collision:IsA("Player") then
collision.Health -= 15
end
end)


and I'm trying to make it take away health instead of instantly killing you. What seems to be wrong?


mog
Join Date:
Posts:
Mar 2022
6386
1 month ago • By mog

you wrote -= 15 instead of = -15



Hello there, I am mog. Message me on Polytoria for any inquiries.

mog
Join Date:
Posts:
Mar 2022
6386
1 month ago • By mog

also im not a coder but shouldnt it be collision.Health = collision.Health - 15?



Hello there, I am mog. Message me on Polytoria for any inquiries.

Gusman
Join Date:
Posts:
Nov 2022
690
1 month ago • By Gusman
WEX
WEX 1 month ago
I need help: My script is - - - script.Parent.Touched:Connect(function(collision) if collision:IsA("Player") then collision.Health -= 15 end end) and I'm trying to make it take away health instead of instantly killing you. What seems to be wrong?

instead of collision.health -= 15 do


collision.health = collision.health - 15


Index Plus Deluxe
Join Date:
Posts:
Sep 2019
667
8 days ago • By Index
mog
mog 1 month ago
also im not a coder but shouldnt it be collision.Health = collision.Health - 15?

Correct, Polytoria doesn't have fancy operators that Roblox does.


Change "collision.Health -= 15" to "collision.Health = collision.Health - 15"
^ along with this, you should also add a debounce to delay the next damage.



i'm index if you couldn't tell