What do you want to achieve? Keep it simple and clear!
How to make player always walk foward but able to go sideways
What is the issue? Include screenshots / videos if possible!
Idk how to do it
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
Don’t think theres any on developer hub and i have no solutions
local RunService = game:GetService("RunService")
local Players = game:GetService("Players")
local player = Players.LocalPlayer
RunService:BindToRenderStep("move", Enum.RenderPriority.Character.Value + 1, function()
if player.Character then
local humanoid = player.Character:FindFirstChild("Humanoid")
if humanoid then
humanoid:Move(Vector3.new(0, 0, -1), true)
end
end
end)
Hmm you could probably disable the players controls to stop them from doing this:
Or you could unbind the players inputs from doing that thing, ofc I dont know how to do that, but just a suggestion.
You could also look at robloxs line runner template as it does this sort of thing, and then you could see how they did it
Heyy, try this script. Is this what you wanted? If yes, don’t forget to make it work on mobile
local RunService = game:GetService("RunService")
local UserInputService = game:GetService("UserInputService")
local Players = game:GetService("Players")
local camera = game.Workspace.CurrentCamera
local player = Players.LocalPlayer
local addSideMax = 1
local finalVector = Vector3.new(0, 0, -1)
local cameraOffset = Vector3.new(0, 10, 15)
camera.CameraType = Enum.CameraType.Scriptable
RunService.RenderStepped:Connect(function()
if player.Character and player.Character:FindFirstChild("HumanoidRootPart") then
local humanoidRootPart = player.Character.HumanoidRootPart
camera.CFrame = CFrame.new(humanoidRootPart.Position + cameraOffset, humanoidRootPart.Position)
end
end)
RunService:BindToRenderStep("move", Enum.RenderPriority.Character.Value + 1, function()
if player.Character then
local humanoid = player.Character:FindFirstChild("Humanoid")
if humanoid then
humanoid:Move(finalVector, true)
end
end
end)
UserInputService.InputBegan:connect(function(inputObject, gameProcessedEvent)
if inputObject.KeyCode == Enum.KeyCode.A then
finalVector = finalVector + Vector3.new(-addSideMax,0,0)
elseif inputObject.KeyCode == Enum.KeyCode.D then
finalVector = finalVector + Vector3.new(addSideMax,0,0)
end
end)
UserInputService.InputEnded:connect(function(inputObject, gameProcessedEvent)
if inputObject.KeyCode == Enum.KeyCode.A then
finalVector = finalVector + Vector3.new(addSideMax,0,0)
elseif inputObject.KeyCode == Enum.KeyCode.D then
finalVector = finalVector + Vector3.new(-addSideMax,0,0)
end
end)