Here is my script:

UserInputService = game:GetService("UserInputService")
player = game:GetService("Players").LocalPlayer
character = player.Character
ReleasedShift = true
if not character or not character.Parent then
	character = player.CharacterAdded:Wait()
end
humanoid = character:WaitForChild("Humanoid")
sprintAnimation = Instance.new("Animation")
sprintAnimation.AnimationId = "rbxassetid://5260675637"
sprintAnimation = humanoid:LoadAnimation(sprintAnimation)
sprintAnimationHold = Instance.new("Animation")
sprintAnimationHold.AnimationId = "rbxassetid://5263793326"
sprintAnimationHold = humanoid:LoadAnimation(sprintAnimationHold)
Equipped = false
script.Parent.Equipped:Connect(function()
	Equipped = true
end)
script.Parent.Unequipped:Connect(function()
	Equipped = false
end)
UserInputService.InputBegan:Connect(function(key)
	if key.KeyCode == Enum.KeyCode.LeftShift then
		if Equipped then
			sprintAnimation:Play()
			sprintAnimation.Stopped:Wait()
			if not ReleasedShift then
				sprintAnimationHold.Looped = true
				sprintAnimationHold:Play()
			end
		end
	end
end)
UserInputService.InputEnded:Connect(function(key)
	if key.KeyCode == Enum.KeyCode.LeftShift then
		if Equipped then
			sprintAnimation.Stopped:Wait()
			sprintAnimationHold.Looped = false
			ReleasedShift = false
			sprintAnimation:AdjustSpeed(-1)
			sprintAnimation:Play()
			sprintAnimation.Stopped:Wait()
			sprintAnimation:AdjustSpeed(1)
		end
	end	
end)

It basically makes the player have a gun-run animation. Though it doesn't really work. This is in a local script. If you could try putting this in your own tool for testing that would be great. Thanks. Please fix :D

2 comments

0

pls use indentation

0

I DID USE INDENTATION