#Can't make my character burn

47 messages · Page 1 of 1 (latest)

steel lotus
#

game.Workspace.Siege.Touched:Connect(function(hit) if game.Players:GetPlayerFromCharacter(hit.Parent) then hit.Parent.Humanoid.Instance.new = ("Fire") end end)

#

im a beginner so idk where the problem

#

siege is a part btw

iron gate
#

Secondly, the problem is that Instance isnt a property of an object

#

To fix it use

#
Instance.new("Fire", hit.Parent.HumanoidRootPart)
#

This wont actually kill the player though, just set them on visual fire. FYI

frozen dawn
#

Wouldn't you just find first child of hit.parent that's humanoid?

iron gate
#

To kill them and set them on fire, do hit.Parent.Humanoid.Health = 0

mild ivy
#

:GetPlayerFromCharacter() returns nil if argument is not a character model

frozen dawn
#

But then you'd have to make a whole variable for humanoid, so that's probably not productive

mild ivy
#

nil is falsy

iron gate
#

The problem isnt gonna be with that part

mild ivy
iron gate
#

Ah

frozen dawn
#

I may be wrong tho

#

I'm dum

mild ivy
#

It's fine. We can safely assume a valid character model has a humanoid.

#

No dumb, just learning.

frozen dawn
#

I'm bad S1 smh

iron gate
steel lotus
iron gate
#

Or if you want less dmg, do
humanoid.Health -= 20

#

But youd also have to remove the fire eventually that way

#

wait(idk)
fire:destroy()

steel lotus
#

okay will try

#

but where do i put the humanoid health ?

frozen dawn
#

Hmmm...

frozen dawn
steel lotus
#

best er said that i had to set the humanoid.health property to 0

#

but where do i make that , like at start of the script

#

sorry if i am confusing

#

game.Workspace.Siege.Touched:Connect(function(hit) if game.Players:GetPlayerFromCharacter(hit.Parent) then Instance.new("Fire", hit.Parent.Humanoid.Health -= 20) end end)

golden canopyBOT
#

studio** You are now Level 1! **studio

steel lotus
#

like thiçs ?

#

this*

mild ivy
#
game.Workspace.Siege.Touched:Connect(function(hit)
    if game.Players:GetPlayerFromCharacter(hit.Parent) then
        local fire = Instance.new("Fire", hit.Parent)
        
        for i = 1, 3 do
          wait(1)
          if hit.Parent.Humanoid.Health < 20 then
            hit.Parent.Humanoid.Health -= 20
          else
            hit.Parent.Humanoid.Health = 0
            break
          end
        end

        fire:Destroy()
    end
end)
steel lotus
#

thx

#

its weird the fire effect is at where i spawn

iron gate
#
hit.Parent.Humanoid.Health -= 20)```
#

the , hit.Parent part defines the parent of the object your making.