Teleport player issue

so i have a script that teleport player than make him walk to a point
the script works when there is only one player
if there is more than one player the script doesnt work & doesnt log an error ,
this video when there is one player

and when there is more than one player nothing happen
here is the script (“server side”)

task.wait(6)
local players = game:GetService("Players")
local SlapStage = script.Parent
local StopKeys = game.ReplicatedStorage:WaitForChild("Stopkey")
local ReKeys = game.ReplicatedStorage:WaitForChild("ReKeys")
local tweenService = game:GetService("TweenService")
local pathfinding = game:GetService("PathfindingService")
local TowersTween = TweenInfo.new(8,Enum.EasingStyle.Quad,Enum.EasingDirection.In)
print("COME ON DO IT ")
for INDEX,player in ipairs(players:GetChildren()) do
	print(INDEX,player)

	local playerSpwan = "Player"..INDEX
	local x = SlapStage:FindFirstChild(INDEX)
	local PlayerCharacter = player.character or player.CharacterAdded:Wait()
	local HumanoidRootPart = PlayerCharacter:FindFirstChild("HumanoidRootPart")
	local Humanoid = PlayerCharacter:FindFirstChild("Humanoid")
	print(HumanoidRootPart,"humanoid",Humanoid,"character",PlayerCharacter,"player spwan",playerSpwan,"X",x)
	HumanoidRootPart.CFrame = SlapStage:FindFirstChild(playerSpwan).CFrame
	StopKeys:FireClient(player)

	local path = pathfinding:CreatePath()
	path:ComputeAsync(HumanoidRootPart.Position, x.Position)
	if path.Status == Enum.PathStatus.Success then
		print("MOVE PLAYER")
		Humanoid:MoveTo(x.Position)
	--Humanoid:MoveTo(x.Position)
	spawn(function()
		Humanoid.MoveToFinished:Wait()
		local t = tweenService:Create(x:FindFirstChild("Tower"),TowersTween,{Size = x:FindFirstChild("Tower").Size + Vector3.new(0,90,0)})
		t:Play()
		t.Completed:Wait()
		ReKeys:FireClient(player)
	end)
end
end
--SlapStage.lava.Size = Vector3.new(282.418, 78.406, 247.392)


here is the stage folder
image

1 Like

okay i fixed it , just switch find first child to wait for child
simply it

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.