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

What is wrong with my script?

Asked by 10 years ago
local c = game.Players:GetChildren() 
local r = math.random(1,game.Players.NumPlayers) 
RANDOMPERSON = nil 
for i = 1,#c do 
if i == r then 
RANDOMPERSON = c[i]
sword = game.Lighting.Sword5:Clone()
sword.Parent = RANDOMPERSON.StarterGear
RANDOMPERSON.Torso.CFrame = CFrame.new(game.Workspace.Juggernaut.Position)
end
end

I got an error saying

Torso is not a valid member of Player

2 answers

Log in to vote
0
Answered by 10 years ago

Torso is a child of Characters not Players, Characters are found in the Workspace while Players are found in the Players child of game.

0
So, what would I do? FamousDoge 0 — 10y
0
RANDOMPERSON.Character.Torso Perci1 4988 — 10y
Ad
Log in to vote
0
Answered by
KAAK82 16
10 years ago

like Perci Commented RandomPerson.Character.Torso also, don't change the Torso Position! change the Character Position! Character:MoveTo() is the correct way to do it! cos the Torso is the connection part for all ur BodyParts and if it changes Position, that means ur Joints Break, and so, Die... so do it my Way!

1
I never knew that. You can access a players character in the Workspace from the Player in Players? Did I understand that wrong? ConnorVIII 448 — 10y
0
if u do for example char = game.Workspace.Guy --This is the Model of the Players Character... so if ya wanted to find the Guy's Player, char:GetPlayerFromCharacter() KAAK82 16 — 10y

Answer this question