-- end function


player.CharacterAdded:connect(characterAdded)

if player.Character then
	characterAdded(player.Character)
end

player.PlayerGui.ChildAdded:connect(checkReviving)


ContextActionService:BindAction("Move", MoveAction, false,  Enum.KeyCode.Left, Enum.KeyCode.Right)

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").Stepped:connect(function()
	if player.Character ~= nil then
		if humanoid then
			if doJump == true then
				jump()
			end
			UpdateAnimationSpeed()
			humanoid:Move(Vector3.new(0,0,-moveDir), false)

		end
	end
end)
