I need help fixing my Baldi’s basics movement for players. I’m using the camera to teleport the player in the direction that they’re looking but if they’re looking at the floor or a roof above them then they just teleport toward the floor/roof which I don’t want, how would I lock their teleports to the X and Z axis?
3 Likes
What about using your mouse to rotate the character and then using its look vector to teleport forwards. The player would be able to rotate him whenever but he can still move only when you want him to
2 Likes
Use the X and Z Position of the mouse in the workspace, but don’t use the Y value. Set that to whatever the player would be above the baseplate.
If you’re going to have more than just a flat baseplate then it might be best to get the position of the Part the mouse is on and calculating the Y value above that part.
2 Likes
i fixed it, i just rotated the player with their camera and got it working!
just added this at the bottom
game:GetService("RunService").RenderStepped:Connect(function(t, deltaTime)
local camera = game.Workspace.CurrentCamera
local rx, ry, rz = camera.CFrame:ToOrientation()
HumanoidRootPart.CFrame = CFrame.new(HumanoidRootPart.CFrame.p) * CFrame.fromOrientation(0, ry, 0)
end)```
3 Likes
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.