#Hoverboard Going Up Forever
1 messages ยท Page 1 of 1 (latest)
Alr
local RunService = game:GetService("RunService")
local character = script.Parent
local humanoid = character:WaitForChild("Humanoid")
local connection = nil
local seat = nil
local attachment = nil
local vectorForce = nil
local orientation = nil
local alignOrientation = nil
local raycastParams = nil
local rayOffset = Vector3.new(0, -8, 0)
local rayVelocity = 0.2
local minimumThrust = 600
local thrust = 2000
local drag = 0.02
local animationTrack = humanoid:WaitForChild("Animator"):LoadAnimation(script:WaitForChild("Animation"))
animationTrack.Priority = Enum.AnimationPriority.Idle
local rayPart = Instance.new("Part")
rayPart.Anchored = false
rayPart.CanCollide = false
rayPart.CanQuery = false
rayPart.CanTouch = false
rayPart.Shape = Enum.PartType.Ball
rayPart.Size = Vector3.one
rayPart.Parent = workspace
local function Loop(deltaTime)
local rayTarget = seat.Position + rayOffset + seat.AssemblyLinearVelocity * rayVelocity
local result = workspace:Raycast(seat.Position, rayTarget - seat.Position, raycastParams)
if result == nil then
vectorForce.Force = Vector3.new(0, minimumThrust, 0)
rayPart.BrickColor = BrickColor.Green()
rayPart.Position = rayTarget
else
local magnitude = (result.Position - rayTarget).Magnitude
vectorForce.Force = Vector3.new(0, minimumThrust + magnitude * thrust, 0)
rayPart.BrickColor = BrickColor.Red()
rayPart.Position = result.Position
end
local velocity = seat.CFrame:VectorToObjectSpace(seat.AssemblyLinearVelocity)
if velocity.Magnitude > 0 then vectorForce.Force -= velocity.Unit * (drag * velocity.Magnitude ^ 2) end
orientation *= CFrame.fromOrientation(0, -seat.SteerFloat * seat.TurnSpeed * deltaTime, 0)
local tiltOrientation = CFrame.fromOrientation(-seat.ThrottleFloat * seat.Torque, 0, -seat.SteerFloat * seat.Torque)
alignOrientation.CFrame = orientation * tiltOrientation
end
local function Seated(active, currentSeat)
if active == false then
if connection == nil then return end
connection:Disconnect()
connection = nil
attachment:Destroy()
vectorForce:Destroy()
alignOrientation:Destroy()
animationTrack:Stop()
elseif currentSeat.Name == "Hoverboard" then
seat = currentSeat
attachment = Instance.new("Attachment", seat)
vectorForce = Instance.new("VectorForce")
vectorForce.Force = Vector3.zero
vectorForce.ApplyAtCenterOfMass = true
vectorForce.Attachment0 = attachment
vectorForce.Parent = seat
orientation = CFrame.fromMatrix(Vector3.zero, seat.CFrame.LookVector:Cross(Vector3.yAxis), Vector3.yAxis)
alignOrientation = Instance.new("AlignOrientation")
alignOrientation.Mode = Enum.OrientationAlignmentMode.OneAttachment
alignOrientation.CFrame = orientation
alignOrientation.Attachment0 = attachment
alignOrientation.Parent = seat
raycastParams = RaycastParams.new()
raycastParams.FilterType = Enum.RaycastFilterType.Exclude
raycastParams.FilterDescendantsInstances = {character, seat:FindFirstChildOfClass("Model")}
connection = RunService.PostSimulation:Connect(Loop)
animationTrack:Play()
end
end
humanoid.Seated:Connect(Seated)
@sour wagon
@fervent scaffold
raycastParams.FilterDescendantsInstances = {character, seat:FindFirstChildOfClass("Model")}
this is not correct
Most likely these:
The rayPart should have Anchored set to true to prevent it from falling due to gravity.
The rayPart.BrickColor should use the BrickColor.new() constructor instead of BrickColor() to create a new BrickColor object.
The rayPart.Transparency is set to 1 to make the part invisible.
The velocity variable should use seat.Velocity instead of seat.AssemblyLinearVelocity.
The calculation of orientation should use Vector3.new() instead of Vector3.zero for better compatibility.
The raycastParams.FilterType should be set to Enum.RaycastFilterType.Blacklist instead of Enum.RaycastFilterType.Exclude to filter out the specified instances.
The raycastParams.FilterDescendantsInstances should exclude the seat itself using seat:FindFirstChildOfClass("Model") to avoid collision with the hoverboard.
So this is the correct one?
Try this:
try what
alr
its still goin up
but now diagonally
and it doesnt turn now
Its so annoying ๐
@north estuarylook at your dms