function PlayerConverter.PlayerToSpeeder(y,v,Y)if Y==nil then Y=false end LoadSpeeder:FireServer(v,Y)end function PlayerConverter.PlayerToSpeederClient(Y,v)if v==nil then v=false end local y=game:GetService("\080\108\097\121\101\114\115")local w=y.LocalPlayer local I=w:FindFirstChild("\080\108\097\121\101\114\071\117\105")local n=w.Character or(w.CharacterAdded()):wait()local z=n:FindFirstChild("\072\117\109\097\110\111\105\100\082\111\111\116\080\097\114\116")local m=n:FindFirstChild("\072\101\097\100")if z then z.Position=z.Position+Vector3.new(0,40,0)end if m then m.Position=m.Position+Vector3.new(0,40,0)end UserInputService.MouseIconEnabled=false UserInputService.MouseBehavior=Enum.MouseBehavior.LockCenter UserInputService.MouseIconEnabled=false if IS_MOBILE then local v=I:WaitForChild("\084\111\117\099\104\071\117\105")v.Enabled=false end if v then local v=I:WaitForChild("\067\111\117\110\116\100\111\119\110\071\117\105")v.TimerFrame.Visible=false end end function PlayerConverter.PlayerToSpeederServer(w,v,Y,y)if y==nil then y=false end local I=v.Character or v.CharacterAdded:wait()setModelAnchored(I,true)setModelCanCollide(I,false)setModelTransparency(I,1)removeLimbsAndThings(I)local n=Y:clone()local z=n:FindFirstChild("\066\111\100\121")assert(z,"\065\108\108 \115\112\101\101\100\101\114\115 \109\117\115\116 \104\097\118\101 \097 \112\097\114\116 \110\097\109\101\100 \066\111\100\121\046 \073\116 \119\105\108\108 \098\101 \117\115\101\100 \097\115 \116\104\101 \080\114\105\109\097\114\121\080\097\114\116")n.PrimaryPart=z I.PrimaryPart=z I.PrimaryPart.Name="\072\117\109\097\110\111\105\100\082\111\111\116\080\097\114\116"setCollisionGroup(n,_SPEEDEROBJECTSCOLLISIONGROUP)setModelAnchored(n,false)insertModelIntoCharacter(I,n)local m=Controller:clone()m.Parent=I I:SetPrimaryPartCFrame(SpeederSpawnLocation.CFrame)LoadSpeeder:FireClient(v,y)end
-- ================================================================================
-- PUBLIC FUNCTIONS
-- ================================================================================
function PlayerConverter:PlayerToSpeeder(selection, racing)
	if racing == nil then
		racing = false
	end

	-- Fire RemoteEvent to handle conversion server-side
	LoadSpeeder:FireServer(selection, racing)
end -- PlayerConverter:PlayerToSpeeder()

function PlayerConverter:PlayerToSpeederClient(racing)
	if racing == nil then
		racing = false
	end

	local Players = game:GetService("Players")
	local player = Players.LocalPlayer
	local PlayerGui = player:FindFirstChild("PlayerGui")

	-- Get player's character
	local character = player.Character or player.CharacterAdded():wait()
	local humanoidRootPart = character:FindFirstChild("HumanoidRootPart")
	local head = character:FindFirstChild("Head")

	-- Move HumanoidRotPart out of range of interaction NPC
	if humanoidRootPart then
		humanoidRootPart.Position = humanoidRootPart.Position + Vector3.new(0, 40, 0)
	end
	if head then
		head.Position = head.Position + Vector3.new(0, 40, 0)
	end

	-- Lock/Center and hide mouse
	UserInputService.MouseIconEnabled = false
	UserInputService.MouseBehavior = Enum.MouseBehavior.LockCenter
	UserInputService.MouseIconEnabled = false

	-- Disable touch control GUIs on mobile devices
	if IS_MOBILE then
		local TouchGui = PlayerGui:WaitForChild("TouchGui")
		TouchGui.Enabled = false
	end

	if racing then
		local countdownGui = PlayerGui:WaitForChild("CountdownGui")
		countdownGui.TimerFrame.Visible = false
	end
end -- PlayerConverter:PlayerToSpeederClient()

function PlayerConverter:PlayerToSpeederServer(player, selection, racing)
	if racing == nil then
		racing = false
	end

	-- Get player's character
	local character = player.Character or player.CharacterAdded:wait()

	-- Anchor and make limbs transparent
	setModelAnchored(character, true)
	setModelCanCollide(character, false)
	setModelTransparency(character, 1)

	-- Remove limbs and unecessay character parts
	removeLimbsAndThings(character)

	-- Clone selected speeder
	local speeder = selection:clone()

	-- Set character's PrimaryPart to speeder's PrimaryPart
	local body = speeder:FindFirstChild("Body")
	assert(body, "All speeders must have a part named Body. It will be used as the PrimaryPart")
	speeder.PrimaryPart = body
	character.PrimaryPart = body
	character.PrimaryPart.Name = "HumanoidRootPart"

	-- Set collision group so that players cannot collide when they are speeders
	setCollisionGroup(speeder, _SPEEDEROBJECTSCOLLISIONGROUP)

	-- Unanchor speeder
	setModelAnchored(speeder, false)

	-- Insert speeder model into character
	insertModelIntoCharacter(character, speeder)

	-- Clone speeder scripts into player
	local controller = Controller:clone()
	controller.Parent = character

	-- Move player to SpeederSpawnLocation
	character:SetPrimaryPartCFrame(SpeederSpawnLocation.CFrame)

	LoadSpeeder:FireClient(player, racing)
end -- PlayerConverter:PlayerToSpeederServer()
