local d=script.Parent local y local I local t local Z local a local X local O local T=script.Parent:FindFirstChild("\079\108\108\105\101\084\104\114\117\115\116")if T==nil then T=Instance.new("\066\111\100\121\084\104\114\117\115\116")T.Name="\079\108\108\105\101\084\104\114\117\115\116"T.force=Vector3.new(0,0,0)T.location=Vector3.new(0,0,-2)T.Parent=d end local G=nil local N=nil local o=true function didAction(d)G=d N=time()end function onAxisChanged(I)d.Steer=y.Steer d.Throttle=y.Throttle if d.Steer==-1 then print("\076\101\102\116")Z:Stop()O:Stop()X:Stop(.5)a:Play(.5)didAction("\108\101\102\116")end if d.Steer==1 then print("\082\105\103\104\116")Z:Stop()a:Stop(.5)O:Stop()X:Play(.5)didAction("\114\105\103\104\116")end if d.Steer==0 then print("\083\116\114\097\105\103\104\116")Z:Stop()a:Stop(.5)O:Stop()X:Stop(.5)if G=="\103\111"and time()-N<.1 then end didAction("\103\111")end end function enterAirState()I.maxTorque=Vector3.new(100,0,100)o=false end function exitAirState()I.maxTorque=Vector3.new(0,0,0)o=true end function enterPushingState()Z:Play()end function onMoveStateChanged(d,y)print(y)print(d)if y==Enum.MoveState.AirFree then exitAirState()end if d==Enum.MoveState.AirFree then enterAirState()end if d==Enum.MoveState.Pushing then enterPushingState()end end
----------------------------------------------------------------------
--
-- HERE BE DRAGONS!
--
-- You can hack together your own scripts using the objects
-- in here, but this is all highly experimental and *WILL BREAK*
-- in a future release. If that bothers you, look away...
--
-- T
--
-----------------------------------------------------------------------

local Board = script.Parent
local Controller
local Gyro
local CoastingAnim
local KickAnim
local LeftAnim
local RightAnim
local OllieAnim

local OllieHack = script.Parent:FindFirstChild("OllieThrust")
if OllieHack == nil then
	OllieHack = Instance.new("BodyThrust")
	OllieHack.Name = "OllieThrust"
	OllieHack.force = Vector3.new(0, 0, 0)
	OllieHack.location = Vector3.new(0, 0, -2)
	OllieHack.Parent = Board
end

local lastaction = nil
local lasttime = nil
local jumpok = true

function didAction(action)
	lastaction = action
	lasttime = time()
end

function onAxisChanged(axis)
	Board.Steer = Controller.Steer
	Board.Throttle = Controller.Throttle

	if Board.Steer == -1 then
		print("Left")
		--CoastingAnim:Stop(1)
		KickAnim:Stop()
		OllieAnim:Stop()
		RightAnim:Stop(0.5)
		LeftAnim:Play(0.5)
		didAction("left")
	end

	if Board.Steer == 1 then
		print("Right")
		KickAnim:Stop()
		--CoastingAnim:Stop(1)
		LeftAnim:Stop(0.5)
		OllieAnim:Stop()
		RightAnim:Play(0.5)
		didAction("right")
	end

	if Board.Steer == 0 then
		print("Straight")

		KickAnim:Stop()
		LeftAnim:Stop(0.5)
		OllieAnim:Stop()
		RightAnim:Stop(0.5)

		if lastaction == "go" and time() - lasttime < 0.1 then
		end
		didAction("go")
		--CoastingAnim:Play(1)
	end
end

function enterAirState()
	-- gyrate towards vertical position for better landing
	Gyro.maxTorque = Vector3.new(100, 0, 100)
	jumpok = false
end

function exitAirState()
	-- turn off gyro
	Gyro.maxTorque = Vector3.new(0, 0, 0)
	jumpok = true
end

function enterPushingState()
	KickAnim:Play()
end

function onMoveStateChanged(newState, oldState)
	print(oldState)
	print(newState)
	-- do state exits here
	if oldState == Enum.MoveState.AirFree then
		exitAirState()
	end

	-- do state transitions here

	-- do state entries here
	if newState == Enum.MoveState.AirFree then
		enterAirState()
	end
	if newState == Enum.MoveState.Pushing then
		enterPushingState()
	end
end
