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

Are these scripts correct?

I tried to experiment and make my own scripts, I don't know if the first one works. I'm pretty sure about the second one, I'm just not sure.

ATTEMPT

function onTouch(Part)
Player:FindFirstChild.Humanoid.Health = 0
end

script.Parent.Touched:connect(onTouch)

ATTEMPT

function onTouch(Part)
Instance.New ("Fire" game.Workspace.Part)
wait(2)
game.Workspace.Part.Fire.Enabled = false
wait(5)
game.Workspace.Part.Fire.Enabled = true
end

script.Parent.Touched:connect(onTouch)

1 answer

✓ Accepted answer

Your first script is incorrect because you didn't reference to the humanoid correctly. Correct syntax would be:

Player:findFirstChild("Humanoid").Health = 0 --Finds the humanoid then sets health at zero. (Given that you already defined Player, too.)

Your second script, everything is correct besides line 2. new should be lowercased, and there should be a comma between "Fire" and "game". You can also remove "Part" from the parameters, since it's not really being defined.

Instance.new("Fire", Workspace.Part) --You can still have "game." it doesn't make a difference really.

If there are any other problems, please inbox me through ROBLOX and I will edit my answer immediately whenever I get the time.

~Kyo-chan

1 comment

0

Thank you Misclear :D

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