Help with a Mobile Sprinting script

So, my mobile sprint script works when you start sprinting, but you can’t disable it. Any help?

function MobileSprint()
	local sprintingmobile = false
	print(sprintingmobile)
	if sprintingmobile == false then
		game:GetService("ContextActionService"):SetTitle("Sprint", "Walk")
		sprintingmobile = true
		game.Players.LocalPlayer.Character:WaitForChild("Humanoid").WalkSpeed = 25
		local runningT = TweenService:Create(camera, Info, sprintFOV)
		game.Players.LocalPlayer.Character.Animate.walk.WalkAnim.AnimationId = "http://www.roblox.com/asset/?id=11792195238"
		runningT:Play()
	else
		game:GetService("ContextActionService"):SetTitle("Sprint", "Run")
		sprintingmobile = false
		game.Players.LocalPlayer.Character:WaitForChild("Humanoid").WalkSpeed = 16
		local walkingT = TweenService:Create(camera, Info, walkingFOV)
		game.Players.LocalPlayer.Character.Animate.walk.WalkAnim.AnimationId = "http://www.roblox.com/asset/?id=14404440964"
		walkingT:Play()		
	end
end
1 Like