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?
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)