local speed = 60 local norm_spd = 40 local ke_y = Enum.KeyCode.LeftShift local fovMax = { FieldOfView = 70 + (speed/5) } local fovMin = { FieldOfView = 70 } local thing = game.Workspace.CurrentCamera local tween = game.TweenService:Create(thing, TweenInfo.new(0.4, Enum.EasingStyle.Sine), fovMax) local tween2 = game.TweenService:Create(thing, TweenInfo.new(0.4, Enum.EasingStyle.Sine), fovMin) local UIS = game:GetService("UserInputService") UIS.InputBegan:Connect(function(input, processed) if processed then return end if input.UserInputType == Enum.UserInputType.Keyboard then if input.KeyCode == ke_y then game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = speed tween:Play() end end end) UIS.InputEnded:Connect(function(input) if input.KeyCode == ke_y then game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = norm_spd tween2:Play() end end)
This is my code, how do I change the animation from walking (the normal animation) to my custom made running animation only when I am sprinting?
Put an animation into wherever you want but im gonna use ServerStorage and name the animation whatever you want but im just gonna call it animation and then do
local ServerStorage = game:GetService("ServerStorage") -- References ServerStorage
local Player = game.Players.LocalPlayer -- References the LocalPlayer
local Humanoid = Player.Character:WaitForChild("Humanoid") -- References the players humanoid
local Animation = Humanoid:LoadAnimation(ServerStorage.Animation) Animation.Play()
Now you're gonna have to make your own animation but just go into the plugins menu, select the rig builder, place down a r15 or r6 dummy, and then click on the animation editer, select the dummy.
Then you can start animating, just make a running animation (tip: You can go into the Home menu to get the moving and rotating options)
Once you're done, click the three dots on the top of the animation editer gui thing, then select export, Do the name and description of the animation, then upload it. Then go to the page where you uploaded it, copy the link. And paste the link into the animation (The actual animation, not in the code) Paste it in the AnimationId property.
Also, if this doesn't help, you can just watch a tutorial, there are lots of tutorial on animation.