Im trying to do a hoverboard, but applying just 1 to the force is causing the hoverboard to fly up super fast. All parts on the Rocketboard are Massless, but the RootPart isn’t and has a high density. This is to make sure that ALL boards have the exact same physics (regardless of shape/size/etc)
I also make the player massless and have low density to make for the same reason as above (so different players don’t get different results due to what they’re wearing adding different amounts of density/etc)
local Player = game.Players.LocalPlayer
game.UserInputService.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.E then
local HumanoidRootPart = Player.Character:FindFirstChild("HumanoidRootPart")
if not HumanoidRootPart then
return
end
local RocketboardModel = game.ReplicatedStorage:FindFirstChild("BasicRocketboard")
if not RocketboardModel then
return
end
local Params2 = RaycastParams.new()
Params2.RespectCanCollide = true
Params2.FilterType = Enum.RaycastFilterType.Exclude
Params2.FilterDescendantsInstances = { Player.Character }
local RaycastDown = workspace:Raycast(HumanoidRootPart.Position, Vector3.new(0, -50, 0), Params2)
if not RaycastDown or not RaycastDown.Instance then
return
end
local RocketboardClone = RocketboardModel:Clone()
RocketboardClone.Name = "Rocketboard"
local Size = RocketboardClone:GetExtentsSize()
-- Correct orientation using player's LookVector with a 180-degree adjustment
local PlayerFacingDirection = HumanoidRootPart.CFrame.LookVector
local SpawnPosition = RaycastDown.Position + Vector3.new(0, (Size.Y / 2) + 2.25, 0)
-- Pivot the rocketboard to spawn position and rotate it to face player's direction (flipped 180 degrees)
RocketboardClone:PivotTo(
CFrame.new(SpawnPosition)
* CFrame.Angles(0, math.atan2(PlayerFacingDirection.X, PlayerFacingDirection.Z) + math.pi, 0)
)
local HeightOffset = HumanoidRootPart.Size.Y / 2 + 0.5
-- Adjust player's position above the Rocketboard
HumanoidRootPart:PivotTo(
CFrame.new(RocketboardClone.Collider.Position + Vector3.yAxis * HeightOffset)
* RocketboardClone:GetPivot().Rotation
)
-- Set up welds and constraints
RocketboardClone.PrimaryPart.CharacterWeld.Part1 = HumanoidRootPart
RocketboardClone.PrimaryPart.AlignOrientation.CFrame = HumanoidRootPart.CFrame.Rotation
RocketboardClone.PrimaryPart.AssemblyLinearVelocity = HumanoidRootPart.AssemblyLinearVelocity
RocketboardClone.PrimaryPart.AssemblyAngularVelocity = HumanoidRootPart.AssemblyAngularVelocity
RocketboardClone.Parent = Player.Character
-- Make the player massless
for _, child in Player.Character:GetDescendants() do
if not child:IsA("BasePart") then
continue
end
if child == HumanoidRootPart then
continue
end
child.Massless = true
end
HumanoidRootPart.CustomPhysicalProperties = PhysicalProperties.new(0.0001, 0, 0)
end
end)