How can I create a script that makes the player move at constant speed?

It is a property of BasePart.

Because it is a property, you can modify it by doing:

YourPartHere.AssemblyLinearVelocity = Vector3.new(x,y,z)

You may want to look into how assemblies work. It’s quite simple! ^-^

1 Like

Sorry for the late reply,
Preferably you want to do it in a LocalScript and place it in StarterCharacterScripts, so it should look something like this.

--< Services >--
local rs =  game:GetService("RunService")

--< Player Variables >--
local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local hrp = char:WaitForChild("HumanoidRootPart")

local connection
connection = rs.Heartbeat:Connect(function()
	hrp.AssemblyLinearVelocity = Vector3.new(X,Y,Z)
end)

--And if you ever want to stop forcing the player from moving in that direction,
you can disconnect the event by doing connection:Disconnect()

This will yield the same results as if you were to use BodyMovers, but the problem is that it won’t give you much freedom to work with.
Also, if the player is barely able to move right/left, just up their WalkSpeed and that should do it.

6 Likes

Thank you! I will take a look in to the links. :grinning:

1 Like

Ok, Thanks! I will test the script out! :grinning:

Thank you for helping me. I learned about Assembly Linear Velocity! Thank you! :grinning:
I made a script using your example:
local part = game.Workspace.Part
part.AssemblyLinearVelocity = Vector3.new(100, 0, 0), and I can use this for another feature of my game. :grinning:

1 Like

Thank you for helping me! Your example helped me a lot. I have been searching tutorials on YouTube, but I couldn’t find the tutorial that I wanted. Thank you! :grinning:

I am glad that helped, but I highly sugguest you look into BodyMovers as they will allow you more freedome and more complex movement.

1 Like