Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to force player movement forward when a brick is touched?

Asked by
krez99 0
5 years ago

Hello, as an example if a player touches on brick, he'd just continuously start going forward until another brick is touched to return to default?

1 answer

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

I made a Local Script that forces forward movement for the Local Player but still allowing the Local Player to turn. Hopefully you can apply this in the way that you desire. Here's the code:

local function Forward()
    local plr = game.Players.LocalPlayer
    local char = plr.Character
    local hpart = char.HumanoidRootPart
    local hum = char.Humanoid
    hum.TargetPoint = hpart.Position + hpart.CFrame.lookVector * 5
    hum:MoveTo(hum.TargetPoint)
end

game:GetService("RunService").Heartbeat:Connect(Forward)
Ad

Answer this question