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

It keeps saying "Torso is not a valid member of Model". How do I fix this?

Asked by
Waywyr 0
5 years ago

I'm trying to make it so that a player is transported from one object to the other by stepping on it, but this error keeps showing up and I have no idea how to fix it.

script.Parent.Touched:connect(function(hit)
    if hit.Parent:FindFirstChild('Humanoid') then
        hit.Parent.Torso.CFrame = CFrame.new(439.763, 4.144, 128.675)


    end
end)

Any help please?

0
Use the HumanoidRootPart for transporting a player. User#21908 42 — 5y

1 answer

Log in to vote
0
Answered by
RayCurse 1518 Moderation Voter
5 years ago

There are two types of default character rigs on Roblox. One is called R15 and the other is called R6 (as you might know already). Different rigs use different names for body parts. For example, the torso is called Torso in R6 rigs and UpperTorso for R15 rigs. In your case, this would simply mean that you would have to change hit.Parent.Torso to hit.Parent.UpperTorso. However, it's better to use HumanoidRootPart as it's consistent amongst all character rigs.

script.Parent.Touched:Connect(function(hit)
    if hit.Parent:FindFirstChild("Humanoid") then
        hit.HumanoidRootPart.CFrame = CFrame.new(439.763, 4.144, 128.675)
    end
end)
0
Thanks for the tip! Waywyr 0 — 5y
Ad

Answer this question