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

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

Asked by 4 years ago

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)

1
Please use the codeblock feature for Lua code. compUcomp 417 — 4y
0
? ivan6361 34 — 4y
1
The codeblock feature in the editor. Also, please practice proper indentation when posting code. compUcomp 417 — 4y

1 answer

Log in to vote
1
Answered by
Filipalla 504 Moderation Voter
4 years ago
Edited 4 years ago

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

Ad

Answer this question