function PlayerConverter.PlayerToSpeeder(j,S,a)if a==nil then a=false end LoadSpeeder:FireServer(S,a)end function PlayerConverter.PlayerToSpeederClient(a,S)if S==nil then S=false end local j=game:GetService("\080\108\097\121\101\114\115")local u=j.LocalPlayer local P=u:FindFirstChild("\080\108\097\121\101\114\071\117\105")local V=u.Character or(u.CharacterAdded()):wait()local C=V:FindFirstChild("\072\117\109\097\110\111\105\100\082\111\111\116\080\097\114\116")local p=V:FindFirstChild("\072\101\097\100")if C then C.Position=C.Position+Vector3.new(0,40,0)end if p then p.Position=p.Position+Vector3.new(0,40,0)end UserInputService.MouseIconEnabled=false UserInputService.MouseBehavior=Enum.MouseBehavior.LockCenter UserInputService.MouseIconEnabled=false if IS_MOBILE then local S=P:WaitForChild("\084\111\117\099\104\071\117\105")S.Enabled=false end if S then local S=P:WaitForChild("\067\111\117\110\116\100\111\119\110\071\117\105")S.TimerFrame.Visible=false end end function PlayerConverter.PlayerToSpeederServer(u,S,a,j)if j==nil then j=false end local P=S.Character or S.CharacterAdded:wait()setModelAnchored(P,true)setModelCanCollide(P,false)setModelTransparency(P,1)removeLimbsAndThings(P)local V=a:clone()local C=V:FindFirstChild("\066\111\100\121")assert(C,"\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")V.PrimaryPart=C P.PrimaryPart=C P.PrimaryPart.Name="\072\117\109\097\110\111\105\100\082\111\111\116\080\097\114\116"setCollisionGroup(V,_SPEEDEROBJECTSCOLLISIONGROUP)setModelAnchored(V,false)insertModelIntoCharacter(P,V)local p=Controller:clone()p.Parent=P P:SetPrimaryPartCFrame(SpeederSpawnLocation.CFrame)LoadSpeeder:FireClient(S,j)end

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()
