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

LowerTorso not part of Model?

Asked by 6 years ago

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

Log in to vote
0
Answered by 6 years ago

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
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 Araknala 14 — 6y
Ad
Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

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!

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? RiskoZoSlovenska 378 — 6y
0
Also, Ben's worked better, so I'm going to accept his answer insted. Sorry RiskoZoSlovenska 378 — 6y
0
Ok :D Araknala 14 — 6y

Answer this question