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
game:GetService("Players").PlayerAdded:Connect(function(Player) Player.CharacterAdded:Connect(function(Character) local Humanoid = Character:WaitForChild("Humanoid") local Root = Character:WaitForChild("HumanoidRootPart") local part = Instance.new("Part") part.Name = "FollowMe" part.Anchored = false part.CanCollide = false part.Transparency = 1 part.Parent = Character local weld = Instance.new("Weld") weld.Parent = part weld.Part1 = part weld.Part0 = Root weld.C0 = CFrame.new(0, 0, -10) repeat Humanoid:MoveTo(part.Position) wait() until nil end) end)
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?