Hey, I am making a walking queue system and when I enable the movement it gets a slow delay. I disabled the players movement then let him walk to a point with simple path(a pathfinding module) and when he presses a butten it teleports him out and enables his movement again. But then he get’s a deley on the movement.
this is the code i used:
leave.OnServerEvent:Connect(function(player)
local plaats = 0
print(player.Name)
local laasts = false
local tags = script.Parent.Walkparts:GetChildren()
local InverseIndex = #tags
player.Character.HumanoidRootPart.CFrame = script.Parent.LeavePart.CFrame
movement:FireClient(player, true)
for i = InverseIndex, 1, -1 do
local part = tags[i]
if part.naam.Value ~= "None" then
print(part.naam.Value)
if part.naam.Value == player.Name then
laasts = true
end
break
end
end
for i = 1,#tags do
local part = tags[i]
plaats = plaats +1
if part.naam.Value == player.Name then
part.naam.Value = "None"
print(plaats)
break
end
end
for i = 1,#tags do
local part = tags[i]
if laasts == false then
print("nietlaatst")
if part.naam.Value ~= "None" and i ~=1 and part.naam.Value ~= player.Name then
wait(1)
move(game.Workspace:WaitForChild(part.naam.Value))
end
end
end
end)