Snowboard model issues

Hey everyone! So I recently put together a snowboard model for a game I’m working on and it moves but it does not work how I wanted it to. My scripting knowledge is limited so I wanted to ask you guys for help to try and fix it, and I also had multiple issues like:

  • I can’t get off the snowboard after mounting it. I can move in all directions which works fine but after getting on the snowboard I can’t get off of it for some reason. And if it’s not in the script already, I wanted to make it the space button that dismounts the player

  • The model has a sitting animation but it’s rotated in the wrong direction and it looks very weird and I wanted to know how to fix that.

Here’s everything you need to know about the snowboard:

  • The placement of everything
    image

*The “Client” local script:

local char = script.Parent
local human = char:FindFirstChild("Humanoid")
local stand = script:WaitForChild("Stand")
local remote = script:WaitForChild("Remote")

local uis = game:GetService("UserInputService")
local keys = Enum.KeyCode

uis.InputBegan:connect(function(inputObject)
	local key = inputObject.KeyCode
	if key == keys.W then
		remote:FireServer("ForwardGo")
	elseif key == keys.S then
		remote:FireServer("BackwardGo")
	elseif key == keys.A then
		remote:FireServer("LeftGo")
	elseif key == keys.D then
		remote:FireServer("RightGo")
	end
end)

uis.InputEnded:connect(function(inputObject)
	local key = inputObject.KeyCode
	if key == keys.W then
		remote:FireServer("ForwardStop")
	elseif key == keys.S then
		remote:FireServer("BackwardStop")
	elseif key == keys.A then
		remote:FireServer("LeftStop")
	elseif key == keys.D then
		remote:FireServer("RightStop")
	end
end)

if human then
	local track = human:LoadAnimation(stand)
	track:Play()
	
	remote.OnClientEvent:connect(function(func, ...)
		if func == "Stop" then
			track:Stop()
		end
	end)
end
  • The “Server” script:
local Board = script.Parent
local Client = Board.Client
local Particle = script.Parent.ParticleEmitter

local CurrentRemote = nil
local CurrentPlayer = nil
local CurrentGyro = nil

local Steer = 0
local Throttle = 0

local Acceleration = 150
local TurnSpeed = math.pi / 2
local MaxSpeed = 100

function onRemote(player, func, ...)
	if player ~= CurrentPlayer then return end
	
	if func == "ForwardGo" then
		Throttle = 1
Particle.Enabled = true
	elseif func == "ForwardStop" then
		if Throttle == 1 then
			Throttle = 0
			Particle.Enabled = false
		end
	elseif func == "BackwardGo" then
		Throttle = -1
		Particle.Enabled = true
	elseif func == "BackwardStop" then
		if Throttle == -1 then
			Throttle = 0
			Particle.Enabled = false
		end
	elseif func == "LeftGo" then
		Steer = 1
		Particle.Enabled = true
	elseif func == "LeftStop" then
		if Steer == 1 then
			Steer = 0
			Particle.Enabled = false
		end
	elseif func == "RightGo" then
		Steer = -1
		Particle.Enabled = true
	elseif func == "RightStop" then
		if Steer == -1 then
			Steer = 0
			Particle.Enabled = false
		end
	end
end

function onChildAdded(obj)
	if obj.Name == "PlatformMotor6D" then
		local torso = obj.Part1
		local char = torso.Parent
		CurrentPlayer = game:GetService("Players"):GetPlayerFromCharacter(char)
		
		if CurrentPlayer then
			local client = Client:Clone()
			CurrentRemote = client.Remote
			CurrentRemote.OnServerEvent:connect(onRemote)
			client.Parent = char
			
			CurrentGyro = Instance.new("BodyGyro")
			CurrentGyro.cframe = Board.CFrame
			CurrentGyro.maxTorque = Vector3.new(0, math.huge, 0)
			CurrentGyro.Parent = Board
		end
	end
end

function onChildRemoved(obj)
	if obj.Name == "PlatformMotor6D" then
		CurrentRemote:FireClient(CurrentPlayer, "Stop")
		CurrentPlayer = nil
		game:GetService("Debris"):AddItem(CurrentRemote.Parent)
		CurrentRemote:Destroy()
		CurrentGyro:Destroy()
		Steer = 0
		Throttle = 0
	end
end

function getForward()
	return Board.CFrame * CFrame.Angles(0, -math.pi/2, 0)
end

function onTick(dt)
	local newVelocity = Board.Velocity + getForward().lookVector * Acceleration * dt * Throttle
	if newVelocity.magnitude > MaxSpeed then
		newVelocity = newVelocity.unit * MaxSpeed
	end
	Board.Velocity = newVelocity
	
	if CurrentGyro then
		CurrentGyro.cframe = CurrentGyro.cframe * CFrame.Angles(0, TurnSpeed * dt * Steer, 0)
	end
end

Board.ChildAdded:connect(onChildAdded)
Board.ChildRemoved:connect(onChildRemoved)
game:GetService("RunService").Heartbeat:connect(onTick)
1 Like

Make sure the animation priority is “action” or higher. I think it’s blending with the default sit animation.

1 Like

It’s set as action and it still doesn’t work

1 Like

This might be due to the AnimationWeightedBlendFix, a feature that broke stuff. Try disabling it, it is a property in Workspace. If it seems to solve your issue you should submit a bug report since the property will be forcefully enabled soon.

Additionally, you should also refrain from using the deprecated SkateboardPlatform. It’s not really performant and the default script for it uses deprecated objects.

1 Like

I tried disabling it and i still have the issue. If you look at the script you’d see that it creates a weld between the lowertorso and the snowboard. I think this is the issue but idk how to fix it because idk how to rotate welds. And also i don’t know how to make it so that when clicking space the player gets off but i tried removing the weld and it still played the animation and it wouldn’t let me on again.

1 Like