How would i port this Running script to context action?

The title says it all lol


function RUN()
			if stamina.Value > 0 then
				if humanoid.MoveDirection.Magnitude > 0 then
					isSprinting = true
					script.SprintEvent:FireServer(true)
			tFovSprint:Play()
		end
	end
end

userInputService.InputEnded:connect(function(input)
	if input.KeyCode == Enum.KeyCode.LeftShift then
		isSprinting = false
		script.SprintEvent:FireServer(false)
		runAnim:Stop()
		tFovWalk:Play()
	end
end)
humanoid.Running:connect(function(speed)
	if speed > 0 then
		if isSprinting then
			if not runAnim.IsPlaying then
				runAnim:Play()
				script.SprintEvent:FireServer(true)
			end
		end
	else
		runAnim:Stop()
		script.SprintEvent:FireServer(false)
	end
end)
stamina.Changed:connect(function()
	if stamina.Value <= 0 then
		isSprinting = false
		script.SprintEvent:FireServer(false)
		runAnim:Stop()
		wait(1.05)
	end
end)


local mobilebutton = contextActionService:BindAction("Interact", RUN, true, Enum.KeyCode.LeftShift)
contextActionService:SetPosition("RunButton",UDim2.new(0.72,-25,0.20,-25))


2 Likes

I ported the running part but im not sure about the userinputended