Kill brick problems

Back
WEX
Join Date:
Posts:
Dec 2023
10
7 months ago | 22 • 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
6448
7 months 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
6448
7 months 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.

WaterMelon1
Join Date:
Posts:
Nov 2022
795
7 months ago • By WaterMelon1
WEX
WEX 7 months 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
Join Date:
Posts:
Streak:
Sep 2019
914
9 days
6 months ago • By Index 9d
mog
mog 7 months 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.



hey, I'm Index!