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

Are these scripts correct?

Asked by 10 years ago

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

Log in to vote
2
Answered by 10 years ago

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

0
Thank you Misclear :D bloonblaster2000 55 — 10y
Ad

Answer this question