function setupTouchedEvents(p)local J=p:GetChildren()for p=1,#J,1 do if J[p]:isA("\066\097\115\101\080\097\114\116")then J[p].Touched:connect(characterTouchedBrick)end end end function characterAdded(p)local J=p:WaitForChild("\072\117\109\097\110\111\105\100")J.WalkSpeed=0 local v=player.PlayerGui:WaitForChild("\083\116\097\114\116\083\099\114\101\101\110")setupTouchedEvents(p)if UserInputService.TouchEnabled==false then v.StartInstructions.StartLabel.Text="\080\114\101\115\115 \083\112\097\099\101 \116\111 \083\116\097\114\116"end if reviving==true then reviving=false v:Destroy()J.WalkSpeed=characterWalkSpeed end end player.CharacterAdded:connect(characterAdded)function checkReviving(p)if p.Name=="\082\101\118\105\118\105\110\103\071\085\073"then reviving=true end end player.PlayerGui.ChildAdded:connect(checkReviving)if UserInputService.TouchEnabled then UserInputService.ModalEnabled=true UserInputService.TouchStarted:connect(function(p,J)if J==false then doJump=true end end)UserInputService.TouchEnded:connect(function()doJump=false end)else ContextActionService:BindAction("\074\117\109\112",function(p,J,v)doJump=J==Enum.UserInputState.Begin end,false,Enum.KeyCode.Space,Enum.KeyCode.ButtonA)end;(game:GetService("\082\117\110\083\101\114\118\105\099\101")).RenderStepped:connect(function()if player.Character~=nil then if player.Character:FindFirstChild("\072\117\109\097\110\111\105\100")then if doJump==true then jump()end player.Character.Humanoid:Move(Vector3.new(0,0,-1),false)end end end)

function setupTouchedEvents(character)
	local parts = character:GetChildren()
	for i = 1, #parts do
		if parts[i]:isA("BasePart") then
			parts[i].Touched:connect(characterTouchedBrick)
		end
	end
end

function characterAdded(newCharacter)
	local humanoid = newCharacter:WaitForChild("Humanoid")
	humanoid.WalkSpeed = 0
	local splashScreen = player.PlayerGui:WaitForChild("StartScreen")
	setupTouchedEvents(newCharacter)
	if UserInputService.TouchEnabled == false then
		splashScreen.StartInstructions.StartLabel.Text = "Press Space to Start"
	end
	if reviving == true then
		reviving = false
		splashScreen:Destroy()
		humanoid.WalkSpeed = characterWalkSpeed
	end
end
player.CharacterAdded:connect(characterAdded)

function checkReviving(addedGui)
	if addedGui.Name == "RevivingGUI" then
		reviving = true
	end
end
player.PlayerGui.ChildAdded:connect(checkReviving)

if UserInputService.TouchEnabled then
	UserInputService.ModalEnabled = true
	UserInputService.TouchStarted:connect(function(inputObject, gameProcessedEvent) if gameProcessedEvent == false then doJump = true end end)
	UserInputService.TouchEnded:connect(function() doJump = false end)
else
	ContextActionService:BindAction("Jump", function(action, userInputState, inputObject) doJump = (userInputState == Enum.UserInputState.Begin) end, false, Enum.KeyCode.Space, Enum.KeyCode.ButtonA)
end

game:GetService("RunService").RenderStepped:connect(function()
	if player.Character ~= nil then
		if player.Character:FindFirstChild("Humanoid") then
			if doJump == true then
				jump()
			end
			player.Character.Humanoid:Move(Vector3.new(0,0,-1), false)
		end
	end
end)
