Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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?

2 comments

0

I don't mean this offensively but is this one of your first time coding?

0

Here are some sources to help you begin to code. https://scriptinghelpers.org/questions/9539/#12184

1 answer

local is used to define a variable and if is 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 function for 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.

This discussion is preserved as it was. New answers, comments, and votes are closed.