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

How do i get a players torso using a server script?

Asked by 7 years ago

this would be a piece of cake if tis script was supposed to be inserted into my player but this script is for an npc, this is not a request

0
Would you not just follow regular hierarchy? You probably need to elaborate. pmcdonough 85 — 7y
0
what does that mean @pmcdonough trubudist 40 — 7y

1 answer

Log in to vote
1
Answered by
Suamy 68
7 years ago

You can access a player's Torso from a server script using this code:

For example, this will TP everyone to the absolute middle of the map.

for i, v in pairs (game.Players:GetPlayers()) do
    v.Character.Torso.CFrame = CFrame.new(Vector3.new(0,0,0))
end

"v" basically represents the players, and "in pairs" means it's looping through a "table" of players. Pretend it's looping through every player in the leaderboard.

You can also access the torso with a touched script using hit.Parent.

script.Parent.Touched:connect(function(hit)
 hit.Parent.Torso  = code here 
end

Hope this helps!

P.S. You can use an if/then statement in the for loop, so you can target certain players.

Ad

Answer this question