Roblox Sprinting

yea i know bout that so

local UIS = game:GetService('UserInputService')
local Player = game.Players.LocalPlayer
local character = Player.Character
local movespeed
character.Humanoid.Running:Connect(function(run)
	movespeed = run
	if run == 0 then
		if PlayAnim and PlayAnim.IsPlaying then
			PlayAnim:Stop()
			character.Humanoid.WalkSpeed = 17.5 -- Base Walk Speed
	end
end
end)

UIS.InputBegan:connect(function(input)
	if input.KeyCode == Enum.KeyCode.LeftShift and movespeed ~= 0 then -- Stops animation from playing while idle
		local Anim = Instance.new('Animation')
		print("ran")
		character.Humanoid.WalkSpeed = 30 -- Sprint Speed
		for i,v in pairs(character:GetChildren()) do
			if v:IsA("Tool") then
				if v:FindFirstChild("GunScript_Server") then
					Anim.AnimationId = v.Sprint.AnimationId
				end
			end
		end
		PlayAnim = workspace.Camera.Arms.Animation:LoadAnimation(Anim) -- Loops aniamtion
		PlayAnim.Looped = true
		PlayAnim:Play()
	end
end)

UIS.InputEnded:connect(function(input)
	if input.KeyCode == Enum.KeyCode.LeftShift then
		character.Humanoid.WalkSpeed = 17.5
		PlayAnim:Stop()
	end
end)

Still doesn’t work lol, any other ideas??

I got one last trick hope this works

local Humanoid = -- get the humanoid
TempMouse.KeyDown:connect(function(Key)
		if string.lower(Key) == "r" then
			Reload()
		elseif Key.Keycode == Enum.KeyCode.LeftShift then
			if not Reloading and ActuallyEquipped and Enabled and not HoldDown and Module.HoldDownEnabled then
				HoldDown = true
				if not VMHoldDownAnim.IsPlaying and  Humanoid:GetState() == Enum.HumanoidStateType.Running then
					VMIdleAnim:Play()
				end
				if AimIdleAnim and AimIdleAnim.IsPlaying then AimIdleAnim:Stop() end
				if IdleAnim and IdleAnim.IsPlaying then IdleAnim:Stop() end
				if VMIdleAnim and VMIdleAnim.IsPlaying then VMIdleAnim:Stop() end
				if HoldDownAnim then HoldDownAnim:Play(nil,nil,Module.HoldDownAnimationSpeed) end
				if VMHoldDownAnim then VMHoldDownAnim:Play(nil,nil,Module.VMHoldDownAnimationSpeed) end
1 Like

BRO, all this time. I could have used AL’s fe gun kit, which already has a sprint function. Headslaps If you think I wasted your time, I really do apologize. Have a great day/night!

1 Like

thanks you too and yea its ok mistakes happen as we are not perfect no one can be perfect.

1 Like