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

LowerTorso not part of Model?

I keep getting an error message that it cannot find the LowerTorso in the player's model. The rig type is always R15, and the script has a wait(3) at the beginning, so the player is loaded before the script starts running. The script is a LocalScript. The line it is in:

local player = game.Players.LocalPlayer -- This line is still OK
local playerPos = player.Character.LowerTorso.Position --Error happens here

2 answers

✓ Accepted answer

You might want to add a CharacterAdded event to make sure that the character is loaded in.

local player = game.Players.LocalPlayer
player.CharacterAdded:connect(function(character)
    local playerPos = character.LowerTorso.Position
end)

1 comment

1

OMG HI BEN! WHAT'S YOUR SKYPE AGAIN? WE HAVEN'T TALKED IN A YEAR! "Violette Cafe" "my game, Poltergiest" || I also have a answer

For the beginning, instead of "wait(3)", do "

local player = local player = game.Players.LocalPlayer
local character= WaitForChild(player.Character)
local playerPos = character.LowerTorso.Position

If this helped, up-vote me :D

P.S You can always take Ben's advice if mine doesn't work, he's really good at scripting!

3 comments

0

but WaitForChild(player.Character) gives you and error. I think its supposed to be player:WaitForChild("Character"). Then again, this doesn't work, because there is no actual "Character" being loaded. Wouldn't repeat wait() until player.Character ~= nil be better?

0

Also, Ben's worked better, so I'm going to accept his answer insted. Sorry

0

Ok :D

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