this script is making the motor cycle spin weridly?
wait(0.1) Players = game:GetService("Players") seat = script.Parent-- the driving seat car = seat.Parent Player = nil forwardsSpeed = 80--if you removed the Configuration folder, it defaults to this speed forwards reverseSpeed = 10--if you removed the Configuration folder, it defaults to this speed backwards StartTime = 1--how long (in seconds) the car should wait before starting up. This is dependant on the starting sfx engineBlock = car:FindFirstChild("EngineBlock")--maybe someone doesn't like sound? lightsOn = false-- whether or not the lights turn on carRunning = false--whether or not the car is running RemoteControlled = car:FindFirstChild("ControlByRemote")--this is so the car turns properly function CalculatePitch()--this returns the pitch that the engine should be at when its travelling return 1+engineBlock.Velocity.magnitude/100 end Configuration = car:FindFirstChild("Configuration")-- so you can change the stats of the car if Configuration then-- if we found an object named Configuration in the car then do this stuff: local ReverseSpeedValue = Configuration:FindFirstChild("Reverse Speed")-- do we have a reverse speed? if ReverseSpeedValue ~= nil then if type(ReverseSpeedValue.Value) == "number" then reverseSpeed = ReverseSpeedValue.Value end ReverseSpeedValue.Changed:connect(function()-- level 1 scripting: go if ReverseSpeedValue.Parent ~= nil then-- this script works, but there are some things if type(ReverseSpeedValue.Value) == "number" then-- to make it look a little better reverseSpeed = ReverseSpeedValue.Value UpdateVehicle() end end end) end local ForwardsSpeedValue = Configuration:FindFirstChild("Forwards Speed") end end end function SurfaceGuiBrightness(part,on,bright)-- this is so the brake lights dim when we drive for _,i in pairs (part:GetChildren()) do if i:IsA("SurfaceGui") then i.Enabled = on if i:FindFirstChild("Frame") and i.Frame:IsA("Frame") then i.Frame.Transparency = bright and 0 or 0.5-- scripting level 4: go end-- for simple statements, you can have a boolean value decide between 2 values -- which is the same as writing -- "if bright then -- i.Frame.Transparency = 0 -- else -- i.Frame.Transparency = 0.5 -- end" --but instead of "then" and "else", you use "and" and "or" end end end hornDebounce = false function Honk()-- if you are reading this then congratulations! you win a prize! if hornDebounce then return end-- unfortunately, I could not think of a way if engineBlock and engineBlock:FindFirstChild("Horn") and engineBlock.Horn:IsA("Sound") then hornDebounce = true-- to allow people to be able to honk the horn for both PC and mobile engineBlock.horn:Play() -- in an unobtrusive way. Sorry! :( print("beep beep") -- UristMcSparks, the guy in charge of the toolbox, doesn't want print statements wait(0.5)-- but since this is a secret, lets keep it between you and me, OK? engineBlock.horn:Stop() hornDebounce = false end end function UpdateVehicle()-- this is for the brake lights and speed and stuff like that if seat.Throttle == 1 and carRunning then-- if we're going forwards seat.MaxSpeed = forwardsSpeed-- give it forwards speed elseif seat.Throttle == -1 and carRunning then-- if we're going backwards seat.MaxSpeed = reverseSpeed-- give it backwards speed else seat.MaxSpeed = 0 -- otherwise, give it 0 speed end if workspace.FilteringEnabled and RemoteControlled then--the idea from scripting level 2 applies to false as well RemoteControlled.Throttle = seat.Throttle-- that is, it also works for "~= false" end-- the reason this line exists is to prevent the server from doing something the client -- is already doing. for _,h in pairs (ReverseLight) do-- all these loops below are just updating the lights h.Enabled = lightsOn and seat.Throttle == -1 end for _,i in pairs (ReverseBulb) do SurfaceGuiStandard(i,lightsOn and seat.Throttle == -1) end for _,j in pairs (RearLight) do j.Brightness = 4-math.abs(seat.Throttle)*3 end for _,k in pairs (RearBulb) do SurfaceGuiBrightness(k,lightsOn,seat.Throttle == 0) end end seat.Changed:connect(UpdateVehicle)-- this is so that when someone drives the car -- the brake and reverse lights change -- and the speed of the car changes CreateStabilizer() while true do for i = 1, 60 do--60/30 == 2, 2 seconds between deciding if it's upside down wait()-- we want the steering and sfx to update as many times a second as we can if workspace.FilteringEnabled then if car:FindFirstChild("LeftMotor") then car.LeftMotor.DesiredAngle = seat.Steer*math.rad(20-seat.Velocity.magnitude/10) end if car:FindFirstChild("RightMotor") then car.RightMotor.DesiredAngle = seat.Steer*math.rad(20-seat.Velocity.magnitude/10) end end -- below: make sure there's a sound to play if carRunning and engineBlock and engineBlock:FindFirstChild("Running") and engineBlock.Running:IsA("Sound") then engineBlock.Running.Pitch = CalculatePitch()-- and make sure that the car is on before trying -- to make sure the engine sounds good end end if car:FindFirstChild("Stabilizer") and car:FindFirstChild("LeftHelper") then if car.Stabilizer.CFrame.lookVector:Dot(car.LeftHelper.CFrame.lookVector) < 0.85 then CreateStabilizer() end elseif car:FindFirstChild("LeftHelper") then CreateStabilizer() end if not flippingDebounce and (seat.CFrame*CFrame.Angles(math.pi/2,0,0)).lookVector.Y < 0.2 then--am I upside down? Spawn(Flip)--flip the bike right side up -- as a fun experiment, see what happens if you replace "Spawn(Flip)" with "Flip()" -- and see what the difference is when you drive the car off the baseplate -- if you did it right, you'll notice that the engine sound changes differently! end end -- scripting level 1000000: go -- if you type 2 dashes like this "--" you can create a comment -- comments aren't executed, so you can type stuff like this! --[==[ if you want to make longer comments you can surround them with the double dashes and double square brackets "--[[" and "--]]" and you can surround those by ones with equals signs in them too so you don't have to type the "--" every single line --]==]
fix pls