Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

HumanoidRootPart is not a valid member of Humanoid?

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

3 comments

0

Can you post more of your code?

0

Can you post more of your code?

0

HumanoidRootPart is not part of Humanoid, it is inside the 'bowser' model like the left arm or right leg.

1 answer

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

This discussion is preserved as it was. New answers, comments, and votes are closed.