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

HumanoidRootPart is not a valid member of Model, what line of code do i use now?

From my last error i had new is not a part of CFrame but now i have HumanoidRootPart is not a valid member of Model. How to fix?

character = game.Players.LocalPlayer.Character script.Parent.MouseButton1Click:Connect(function() character.HumanoidRootPart = CFrame.new(workspace.Respawn.Position) end)

3 comments

1

Please use the codeblock feature for Lua code.

0

?

1

The codeblock feature in the editor. Also, please practice proper indentation when posting code.

1 answer

✓ Accepted answer

The first problem:

The first problem is very strange and the HumanoidRootPart should be there, getting the RootPart from the property might work to fix this

The second problem:

You are trying to set the HumanoidRootPart to a CFrame when what you actually want is to set HumanoidRootPart.CFrame like shown below

The solution:

character = game.Players.LocalPlayer.Character script.Parent.MouseButton1Click:Connect(function() 
	character:FindFirstChildOfClass("Humanoid").RootPart.CFrame = CFrame.new(workspace.Respawn.Position)
end)

Wiki:

FindFirstChildOfClass

Humanoid.RootPart

Don't forget to mark my answer as the solution and upvote it if it answered your question :)

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