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

Is not a valid member of part?

Asked by
Grehg 5
6 years ago
Edited 6 years ago

hey everyone, can someone help me out with this code? why doesnt it work?

local player = game.Players.LocalPlayer
local char = player.Character
local rS = char.Torso("Right Shoulder")

print(rS)
0
`local rS = char.Torso:WaitForChild('Right Shoulder')`? TheeDeathCaster 2368 — 6y
0
thank you! Grehg 5 — 6y
0
Np. TheeDeathCaster 2368 — 6y

1 answer

Log in to vote
1
Answered by 6 years ago

You're likely getting this error because the character hasn't loaded in before the code is run. Try this:

local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local rS = char.Torso("Right Shoulder")
print(rS)
0
Use WaitForChild or square brackets for that. UgOsMiLy 1074 — 6y
Ad

Answer this question