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

Im trying to make a lava brick but it wont work! help me please?

Asked by
Crlab 0
9 years ago
local if touched h.HP = 0
Children:BreakJoints    
end

everytime I typed something is incorrect. heres by error code. Expected idenfier, got if.

Can you help me?

0
I don't mean this offensively but is this one of your first time coding? BobserLuck 367 — 9y
0
Here are some sources to help you begin to code. https://scriptinghelpers.org/questions/9539/#12184 M39a9am3R 3210 — 9y

1 answer

Log in to vote
0
Answered by
Uroxus 350 Moderation Voter
9 years ago

localis used to define a variable and ifis a (conditional) statement... These two should not end up on the same line :)

Also, just from looking at the script you've provided, that would do absolutely nothing. You've not created a functionfor touched, and h.HP does not seem to be defined...

script.Parent.Touched:connect(function(kill) -- Make the script fire when the part is touched
    h = kill.Parent:FindFirstChild("Humanoid") -- Locate the part of the player with the health (Humanoid) 
    h.Health = h.Health - 110 -- Set the health to zero
end)

Bare in mind I've not been able to test this so possibly wont work.

If this has answered your question, please accept the answer with the button on the right. If this does not work please do tell me and if you'd like a better, more in depth explanation then please feel free to ask.

Ad

Answer this question