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

Moving all players at once? [closed]

Asked by 8 years ago

Any Ideas how to tell the game to find all players with the Players service and then moving their CFrame? Kinda new to using the Players service.

2
Use a for loop to gather all players in the Player Service and access their characters to CFrame their torsos. We can not make the script for you otherwise it'd be a request. M39a9am3R 3210 — 8y
0
I refreshed the question so its better Conmmander 479 — 8y

Closed as Not Constructive by Perci1 and M39a9am3R

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?

2 answers

Log in to vote
0
Answered by 8 years ago

Hello I understand you must be a novice scripter. I'm here to help.

-- So first you must gather the things you want or  get the children of the parent(the instance)
-- Instance(in this case is game.Players)
-- In order to keep track of the children we have to name them as a variable like this

local Children= game.Players:GetChildren()
-- Get children is a method to obtain every object that is inside a said instance such as Players

--Now we have to look though each child. We do that with    index,last Child  in pairs (Object) do
-- Like this

for i,v in pairs (Children) do
-- so I is the index meaning all of the Children and v is the child that the script is currently on.
-- so v replaces Children

v.Character:MoveTo(Vector3.new(1,1,1))
end


-- So v is the current child the script is on. Character is the character of the player
-- and to position Models you have to use the method :MoveTo(Vector3.new(x,y,z))
--
Ad
Log in to vote
0
Answered by 8 years ago

This script cycles through all players and moves their torso to a certain position

for _, player in pairs(game.Players:GetPlayers())do --cycles through every "player" in Players
if player then
    local character = player:FindFirstChild("Character")
        if character then
            character.Torso.CFrame = CFrame.new()
        end
    end
end
0
It's not necessary to check "if player" and your indentation is wrong. gskw 1046 — 8y