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

I need help with a script?

Asked by
Prioxis 673 Moderation Voter
9 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.

I made a script that will create a fire in the characters torso and disables it until the character has 25 health then it enables itself until the character dies.. But it doesn't work

heres my script

local player = game.Players.LocalPlayer
wait()
f = Instance.new("Fire")
f.Parent = player.Character.Torso
f.Enabled = false
if player.Character.Humanoid.Health == 25
    then
    f.Enabled = true
end

Can anyone please help me

1 answer

Log in to vote
0
Answered by
M39a9am3R 3210 Moderation Voter Community Moderator
9 years ago

All I did was add a .Changed event so the script would execute that if then statement whenever the humanoid loses health or something like that.

local player = game.Players.LocalPlayer
wait()
f = Instance.new("Fire")
f.Parent = player.Character.Torso
f.Enabled = false
player.Character.Humanoid.Changed:connect(function() --You want to have the script check whenever the health changes.
if player.Character.Humanoid.Health == 25
    then
    f.Enabled = true
end
end)
Ad

Answer this question