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

HumanoidRootPart is not a valid member of Humanoid?

Asked by 2 years ago

the code doesn't work and idk why it doesn't, but here's the code I used before:

Bowser Script

        local function createFirebolt()
                         local firebolt = Instance.new("Part")
             firebolt.Position = bowser.HumanoidRootPart.Position + Vector3.new(-2,0,0)--Error
              firebolt.Shape = "Ball"
                firebolt.Size = Vector3.new(1,1,1)
           firebolt.BrickColor = BrickColor.Red()
           firebolt.CanCollide = false
            firebolt.Parent = workspace
0
Can you post more of your code? JustinWe12 723 — 2y
0
Can you post more of your code? JustinWe12 723 — 2y
0
HumanoidRootPart is not part of Humanoid, it is inside the 'bowser' model like the left arm or right leg. D4_rrk 89 — 2y

1 answer

Log in to vote
0
Answered by 2 years ago

here's the full bowser code:

      local bowser = script.Parent:WaitForChild("Humanoid")
           local Debris = game:GetService("Debris")
       local spellAnimTrack = bowser:LoadAnimation(script.Animation)
         spellAnimTrack.Looped = false

        local function onDeath()
      local bridge = script.Parent.Parent.bridge
      bridge.Transparency = 0
       bridge.CanCollide = true
            end
          bowser.Died:Connect(onDeath)

       local function spellLanded(hit, spell)
           if hit.Parent:FindFirstChild("Humanoid") then
              local character = hit.Parent
               spell:Destroy()
                  if character:FindFirstChild("enchanted") and character.enchanted.Value == true then
                 bowser.Humanoid.Health = bowser.Humanoid.Health - 
     (bowser.Humanoid.MaxHealth / 3)
         character.enchanted.Value = false
      else
         character.Humanoid.Health = character.Humanoid.Health - 
      (character.Humanoid.MaxHealth / 3)

               local force = Instance.new("BodyForce")
                force.Force = Vector3.new(-2000, 1000, 0)
               force.Parent = character.HumanoidRootPart
              character.Humanoid.Sit = true
             wait(2)
                force:Destroy()

        end

      end
     end

        local function createFirebolt()
            local firebolt = Instance.new("Part")
          firebolt.Position = bowser.HumanoidRootPart.Position + Vector3.new(-2,0,0)
            firebolt.Shape = "Ball"
             firebolt.Size = Vector3.new(1,1,1)
             firebolt.BrickColor = BrickColor.Red()
                 firebolt.CanCollide = false
                 firebolt.Parent = workspace

         firebolt.Touched:Connect(function(hit)
                    spellLanded(hit, firebolt)
                 end)

                        local fire = Instance.new("Fire", firebolt)

        local force = Instance.new("BodyForce")
                force.Force = Vector3.new(-10, 72, 0)
               force.Parent = firebolt

               Debris:AddItem(firebolt, 2)
          end


             wait(2)
             while bowser.Health > 0 do
                spellAnimTrack:Play()
                    createFirebolt()
               wait(2)
       end
Ad

Answer this question