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

Player does not want to Move to Part?

Asked by
DogeIXX 172
4 years ago

Hey. Second question for today. I want to move Players to a specific Part, but it does not work. When I use it with NPCs, it works fine. But with Players it does not. I dont get any error or anything.

Script:

for i, plr in ipairs(workspace.InGame:GetChildren()) do
local char = game.Players:FindFirstChild(plr.Name).Character
local hum2 = char.Humanoid
local pointB = workspace.StartPoints:FindFirstChild("SP"..NumberA)

    game.ReplicatedStorage.StartGame:FireClient(game.Players:FindFirstChild(plr.Name))
    game.Players:FindFirstChild(plr.Name).Character.Humanoid.Torso.CFrame = CFrame.new(-2.75, 8.458, 53.23)
    print("SP"..NumberA)
    hum:MoveTo(pointA.Position)
    NumberA = NumberA + 1
    wait(1)
end

(The parts exist btw, that cant be the Problem)

2 answers

Log in to vote
0
Answered by 4 years ago

Torso isnt inside humanoid, but just the character.

0
Hm, you are right. The thing is, the CFrame part works perfectly. The character gets teleported to the start. But the part where the character should move to a part does not work. DogeIXX 172 — 4y
0
have you tried it without the humanoid before torso tho? jdm4llfem8 94 — 4y
Ad
Log in to vote
0
Answered by
DogeIXX 172
4 years ago

I got the answer by myself.

First of, I am dumb.

local hum2 = char.Humanoid
local pointB = workspace.StartPoints:FindFirstChild("SP"..NumberA)

hum:MoveTo(pointA.Position)

It is self explained.

Secondly, due to being in the air, the :MoveTo() got cancelled instantly, so I had to put a

wait(1)

between.

Hope this helps someone who has a similar problem.

Answer this question