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

LowerTorso is not a valid member of Model?

Asked by 4 years ago

So I followed XxxLloyd061302xxX tutorial on how to make a Keybind Script for NPC, here's the link: https://www.youtube.com/watch?v=QYXCqa5knRk It's basically showing the Gui and change its position. Here's the script:

while wait() do
    script.Parent.Visible = false 
    for i, v in pairs(game.Workspace.NPCs:GetChildren()) do
    local mag = (v.LowerTorso.Position - game.Players.LocalPlayer.Character.HumanoidRootPart.Position).magnitude
    if mag <= 10 then
        local WSP = game.Workspace.CurrentCamera:WorldToScreenPoint(v.LowerTorso.Position)
        script.Parent.Visible = true
        script.Parent.Position = UDim2.new(0,WSP.X,0,WSP.Y)
        script.Parent.TextLabel.Text = "to chat with "..v.Name 

    end
    end
end

But the output shows an error:

LowerTorso is not a part of Model. I basically followed him, make a folder in Workspace called NPCs and put the NPC in there and now it's showing that error. I couldn't figure out what is causing the error. My NPC is R15. Thanks!

1 answer

Log in to vote
0
Answered by 4 years ago

Try replacing 'LowerTorso' with 'HumanoidRootPart'

game.Workspace.CurrentCamera:WorldToScreenPoint(v.HumanoidRootPart.Position)

Didn't know your'e following Tutorials, I thought you scripted it yourself.

0
well i mean some are not scriptable with my knowledge. i'm learning more MinuhaYT 19 — 4y
0
also im just accepting ur answer because i think you'd like some of the tasty rep and i solved the prob. It's actually WaitForChild("LowerTorso") MinuhaYT 19 — 4y
Ad

Answer this question