Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Changing custom animations. Why won't this work?

So I was browsing around and I found a cool script that changes the default roblox animations such as the /e dance emotes, running & more. It works perfectly but I have a sprinting script and when I hold LShift I want it to change my animation. However the walking animation stays the same every time. I Hold shift. Though running still works. Here is my code. Can you tell me why nothing changes?

local mouse = game.Players.LocalPlayer:GetMouse()
local running = false

function getTool()	
	for _, kid in ipairs(script.Parent:GetChildren()) do
		if kid.className == "Tool" then return kid end
	end
	return nil
end


mouse.KeyDown:connect(function (key) -- Run function
	key = string.lower(key)
	if string.byte(key) == 48 then
		running = true
		local keyConnection = mouse.KeyUp:connect(function (key)
			if string.byte(key) == 48 then
				running = false
			end
		end)
		for i = 1,5 do
			game.Workspace.CurrentCamera.FieldOfView = (70+(i*2))
			wait()
		end
		game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 25
		game.StarterPlayer.StarterCharacterScripts.Animate.run.RunAnim.AnimationId = "rbxassetid://1097485671"
		game.StarterPlayer.StarterCharacterScripts.Animate.run.Value = "rbxassetid://1097485671"
		repeat wait () until running == false
		keyConnection:disconnect()
		game.StarterPlayer.StarterCharacterScripts.Animate.run.RunAnim.AnimationId = "rbxassetid://1133938255"
		game.StarterPlayer.StarterCharacterScripts.Animate.run.Value = "rbxassetid://1133938255"
		game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 8
		for i = 1,5 do
			game.Workspace.CurrentCamera.FieldOfView = (80-(i*2))
			wait()
		end
	end
end)

1 answer

Because the Animation ID for lines 26 and 30 are the same, but thats just from first glance.

1 comment

0

bump

This discussion is preserved as it was. New answers, comments, and votes are closed.