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

Need help, Script won't work? D:

Asked by
KenzaXI 166
9 years ago

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

As the title sais, the following script won't work:

local Log = script.Parent.Head
function onTouch (Brick)
    if Log.Parent.Humanoid.Health == 0 then
        local Fire = Instance.new("Fire", script.Parent.Head)
        Fire.Size = 10
        Fire.Color = Brick.color:Random()
        Fire.SecondaryColor = Brick.Color:Random()
        wait(2)
        Fire:Remove()
    end
end
Log.Touched:connect(onTouch)

ok so I want it so when the health is 0 it lights up fire. But the problem is I can't Damage the Model... Can you help me please?

0
plz put the code in code block davness 376 — 9y
0
done. KenzaXI 166 — 9y
0
what do you expect with the code davness 376 — 9y
0
Read the Desc. KenzaXI 166 — 9y
View all comments (3 more)
0
so do you want to do it. When you're dead and you touch a brick, your head will be in fire? davness 376 — 9y
0
I need it so, I can Damage the Model, Even though I've inserted a Humanoid I can't Damage it KenzaXI 166 — 9y
0
or do you want to kill a guy and make his head to fire? davness 376 — 9y

1 answer

Log in to vote
0
Answered by
ImageLabel 1541 Moderation Voter
9 years ago

Everything seems correct except your use of BrickColor's Random function. It should be used like so.. BrickColor.Random() instead of.. Brick.Color:Random()

local Log = script.Parent.Head

function onTouch (Brick)
    local humanoid = Log.Parent.Humanoid
    if Brick and humanoid.Health > 0 then
        humanoid:TakeDamage(10)

    else 
        local Fire = Instance.new("Fire", Log)
        Fire.Size = 10
        Fire.Color = BrickColor.Random()
        Fire.SecondaryColor = BrickColor.Random()
        wait(2)
        Fire:Remove()
    end
end

Log.Touched:connect(onTouch)
0
Yeah, But I cant Damage the Model D: KenzaXI 166 — 9y
Ad

Answer this question