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

how to fix 2d player movement ?

Asked by 3 years ago

so im making a 2d game, but everytime the player press A / D he flicks, if he is jumping he tp's to the ground

that's my code:

game.ReplicatedStorage.Movement.A.OnServerEvent:Connect(function(plr)
    plr.Character.HumanoidRootPart.Orientation = Vector3.new(plr.Character.HumanoidRootPart.Orientation.X,90,plr.Character.HumanoidRootPart.Orientation.Z)
end)

game.ReplicatedStorage.Movement.D.OnServerEvent:Connect(function(plr)
    plr.Character.HumanoidRootPart.Orientation = Vector3.new(plr.Character.HumanoidRootPart.Orientation.X,-90,plr.Character.HumanoidRootPart.Orientation.Z)
end)

if you need more info, comment

1 answer

Log in to vote
0
Answered by 3 years ago

You can use ContextActionService for unbinding certain movement keys.

You can find info about it here: https://developer.roblox.com/en-us/api-reference/class/ContextActionService

I hope this helped!

0
i mean, i already have the movement, but i wanna make so when he walks to the right, he looks to the right instatly, same thing for the left MacGames007 114 — 3y
Ad

Answer this question