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

Help with MoveTo function?

Asked by
FiredDusk 1466 Moderation Voter
7 years ago

I am wondering if on line 3 of this code would work if I found a specific object in a Vector3.

function GetPlayers()
    for i,v in pairs(game.Players:GetPlayers()) do
        v.Character.MoveTo(Vector3.new(game.Workspace:FindFirstChild("Map").TP.Position)) --Here
    end
end
0
game.Workspace.Map.CFrame Jephi 42 — 7y
1
Could it be game.Workspace.Map.TP.CFrame? FiredDusk 1466 — 7y

1 answer

Log in to vote
0
Answered by 7 years ago
Edited 7 years ago

MoveTo is a function!

Remember when calling a function you use ':' not '.' as it's not a property.

'v.Character.MoveTo'... should be 'v.Character:MoveTo'

Position is a Vector3 value not a CFrame value!

'TP.Position' ... should be 'TP.CFrame' assuming it's a part of some-sort.

Your code should look like this:

function GetPlayers()
    for i,v in pairs(game.Players:GetPlayers()) do
        v.Character:MoveTo(Vector3.new(game.Workspace:FindFirstChild("Map").TP.CFrame)) --Here
    end
end
0
You said "Position is a Vector3 value not a CFrame value!" but then why did you keep "TP.CFrame"? FiredDusk 1466 — 7y
0
Because CFrame is a CFrame value not a Vector3 value. UniversalDreams 205 — 7y
Ad

Answer this question