So basically I want to force a player to move in the direction their HumanoidRootPart is facing.
I tried doing a few things and every time it would go a random direction or just stop working at one point.
I tried using the lookVector of the HumanoidRootPart and it didn't work.
You can force the character to move using the :MoveTo()
function of Humanoids. If you place a part in front of the player, you can force them to continuously move by welding it (the part will be at a fixed offset) and setting the player to move to the part continuously.
Example Script
01 | game:GetService( "Players" ).PlayerAdded:Connect( function (Player) |
02 | Player.CharacterAdded:Connect( function (Character) |
03 | local Humanoid = Character:WaitForChild( "Humanoid" ) |
04 | local Root = Character:WaitForChild( "HumanoidRootPart" ) |
05 |
06 | local part = Instance.new( "Part" ) |
07 | part.Name = "FollowMe" |
08 | part.Anchored = false |
09 | part.CanCollide = false |
10 | part.Transparency = 1 |
11 | part.Parent = Character |
12 |
13 | local weld = Instance.new( "Weld" ) |
14 | weld.Parent = part |
15 | weld.Part 1 = part |
This however doesn't prevent the player from unbinding the movement themselves, but the loop will prevent them from effectively stopping walking.
Closed as Not Constructive by SerpentineKing and EpicMetatableMoment
This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.
Why was this question closed?