Trying to attach animations to a character riding a skateboard that will play a riding animation while nothing is being pressed, a pushing animation when moving forward and tricks when a button is pressed with the space bar.
However the animations that I have created appear different to how they were in the animation editor, I’m not sure if its something in the server script that is effecting this or something to do with the animations but here is how its supposed to look
vs how it ends up looking
and here is the server script
game.Players.PlayerAdded:Connect(function(player)
game.Workspace:WaitForChild(player.Name)
game.Workspace[player.Name]:WaitForChild("HumanoidRootPart")
local skateboard = game.ServerStorage.GameObjects.Skateboard:Clone()
skateboard.CFrame = (player.Character.HumanoidRootPart.CFrame - Vector3.new(0, 0, 0))
skateboard.Parent = player.Character
local hitbox = Instance.new("Part", player.Character)
hitbox.Size = Vector3.new(4, 4, 4)
hitbox.Shape = "Ball"
hitbox.CanCollide = false
hitbox.Transparency = 1
hitbox.CFrame = player.Character.HumanoidRootPart.CFrame
local weld = Instance.new("WeldConstraint", hitbox)
weld.Part0 = hitbox
weld.Part1 = player.Character.HumanoidRootPart
local motor6d = Instance.new("Motor6D", skateboard)
motor6d.Parent = player.Character.HumanoidRootPart
motor6d.Name = "SkateboardMotor6D"
motor6d.Part0 = player.Character.HumanoidRootPart
motor6d.Part1 = skateboard
local bodyVelo = Instance.new("BodyVelocity", player.Character.HumanoidRootPart)
bodyVelo.MaxForce = Vector3.new(100000000000, 0, 100000000000)
bodyVelo.P = 5000
local velocity = Instance.new("NumberValue", player)
velocity.Name = "Velocity"
local canChange = true
hitbox.Touched:Connect(function(part)
if not part:IsDescendantOf(game.Workspace.Surfaces) and not part:IsDescendantOf(game.Workspace:WaitForChild(player.Name)) then
game:GetService("TweenService"):Create(velocity, TweenInfo.new(0.001), {Value = 0 - velocity.Value}):Play()
end
end)
velocity.Changed:Connect(function()
if canChange == true then
if velocity.Value > 40 then
canChange = false
game:GetService("TweenService"):Create(velocity, TweenInfo.new(0.001), {Value = 40}):Play()
wait(0.1)
canChange = true
end
bodyVelo.Velocity = player.Character.HumanoidRootPart.CFrame.LookVector * velocity.Value
game:GetService("TweenService"):Create(velocity, TweenInfo.new(velocity.Value / 2, Enum.EasingStyle.Linear), {Value = 0}):Play()
end
end)
end)
Any help is much appreciated