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

LowerTorso is not a valid member of Model?

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

✓ Accepted answer

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.

2 comments

0

well i mean some are not scriptable with my knowledge. i'm learning more

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

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