-- we could have missed the onEquip event on script start

if Board.Controller and not Controller then

	onEquip(Board.ControllingHumanoid, Board.Controller)

end

function cruiseModify()
	-- change the pitch and volume of the cruising sound

	local v = Board.Velocity.magnitude

	if (v < 1) then
		Board.CruiseLoop.Volume = 0.1
		return
	end

	local lowPitch = .85
	local topPitch = 1.1

	local lowV = .1
	local topV = 1

	Board.CruiseLoop.Volume = math.min(((topV - lowV) * (v / topSpeed)) + lowV, 1)
	Board.CruiseLoop.Pitch = ((topPitch - lowPitch) * (v / topSpeed)) + lowPitch

	
end

function breakModifyAndPlay()
	local v = Board.Velocity.magnitude
	
	local slowest = 10
	if (v < slowest) then return end

	local lowV = .05
	local topV = .8

	Board.BoardStop.Volume = math.min(((topV - lowV) * (v / (topSpeed - slowest))) + lowV, 1)
	Board.BoardStop:Play()
end

while true do
	cruiseModify()
	wait(.1)
end
