Help with ice skating system

Hello Dev Forum. I am trying to create an ice skating system where the player is always moving in the direction they are facing like ice or roller skating in real life. For some reason, they would only move in one direction. Can anyone help me out?

local bv = Instance.new("BodyVelocity")
bv.MaxForce = Vector3.new(math.huge,0,math.huge)
bv.Parent = Model.UpperTorso
			
spawn(function()
	while true do
		    bv.Velocity = Character.HumanoidRootPart.CFrame.LookVector * 30
			wait()
		end
end)

Maybe just maybe the lookvector of the camera is better to use in this context try it out

local camera = workspace.CurrentCamera --we would have to transition to a local script
local bv = Instance.new("BodyVelocity")
bv.MaxForce = Vector3.new(math.huge,0,math.huge)
bv.Parent = Model.UpperTorso
			
spawn(function()
	while true do
bv.Velocity = camera.CFrame.LookVector * 30
			wait()
		end
end)
4 Likes

Would there be a way to get the camera from the server?

2 Likes

Wait nevermind I got it to work thank you! By the way would you happen to know how I should keep the character always facing fowards?

2 Likes
local camera = workspace.CurrentCamera
local run = game:GetService("RunService")
local char = script.Parent
local root = char:WaitForChild("HumanoidRootPart")

run.RenderStepped:Connect(function ()
    local x, y, z = camera.CFrame:ToOrientation()

    local newCF = CFrame.new(root.Position)
    root.CFrame = newCF * CFrame.Angles(0, y, 0)
end)

I wrote that just now but it should work.

1 Like