And what that script does is to move the player to a specific location but the problem here is that the player can move while the script is still moving the player and that will stop the script from moving the player so how do I disable the player from moving while the script is moving the player?
I have tried to set the player’s walk speed to 0 so the player can’t move while the script is moving the player but that will also stop the script from working and when the player’s walk speed is back to 16 the script will work again.
So there would be a way to move the player through the server and making them not move for a set amount of time. which this would involve Remote Events, which would make the job easier since you can fire them through a local script, but here is the code I made for you. And to keep in mind this is a server script.
-- [[ DATA ]] --
local TeleportWalkspeed = 0
local NormalWalkspeed = 16
local Event = [[ Your event location ]]
-- [[ FUNCTIONS ]] --
function Teleport(Character, DestinationCFrame)
if ( Character ) then
Character.Humanoid.Walkspeed = TeleportWalkspeed
wait(0.11) -- Delay
Character.Humanoid:MoveTo(Vector3.new(DestinationCFrame))
wait(0.11) -- Delay
Character.Humanoid.Walkspeed = NormalWalkspeed
end
end
-- [[ CONNECTIONS ]] --
Event.OnServerEvent:Connect(function(Arg1, Arg2)
Teleport(Arg1, Arg2)
end)
I want to move the player to a specific location by the server and not teleport the player, the issue here is that the player can move while the server is moving the player and I wanted to know if there’s a way to prevent that.
It’s only available through the client, you need a Server-Client RemoteEvent. When a player joins, make the server fire to the client to disable their controls until the MoveTo finishes, then fire again to enable the controls