Ever since i’ve developed in studio i’ve been wondering how to change the walk, run and jump animations.
One time I asked GPT, for a solution and when he gave me the script i almost wanted to throw gpt out of my window.. TRASH, but i mean gpt checks all internet so how did he get it wrong…
THEN MY IDEA WAS BORN:
“why dont i ask the super smart developers in forum”
_________________________________________________+Clear+
So if one of yall have a script that changes the animations or just teaching me how to do it.. I WOULD ABSOLUTELY APPRECIATE IT
my system rn:
local script (starterplayer):
– StarterPlayerScripts/ShiftToRun.lua
local UserInputService = game:GetService(“UserInputService”)
local Players = game:GetService(“Players”)
local RunService = game:GetService(“RunService”)
local player = Players.LocalPlayer
local camera = workspace.CurrentCamera
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild(“Humanoid”)
local animator = humanoid:WaitForChild(“Animator”)
– Speeds
local WALK_SPEED = 16
local RUN_SPEED = 36
local WALK_ID = “113125122325043”
local RUN_ID = “92803265229779”
local JUMP_ID = “96859024100057”
local STOP_ID = “101773556814911”
– State
local isRunning = false
local cameraShakeConnection
– Load Animations
local function loadAnim(id, priority, looped)
local anim = Instance.new(“Animation”)
anim.AnimationId = “rbxassetid://” .. id
local track = animator:LoadAnimation(anim)
track.Priority = priority
track.Looped = looped
return track
end
local walkTrack = loadAnim(WALK_ID, Enum.AnimationPriority.Movement, true)
local runTrack = loadAnim(RUN_ID, Enum.AnimationPriority.Movement, true)
local jumpTrack = loadAnim(JUMP_ID, Enum.AnimationPriority.Action, false)
local stopTrack = loadAnim(STOP_ID, Enum.AnimationPriority.Action, false)
– Helper Functions
local function stopAllMovementAnims()
walkTrack:Stop(0.1)
runTrack:Stop(0.1)
end
local function startWalking()
stopAllMovementAnims()
task.wait(0.05)
walkTrack:Play(0.2)
end
local function startRunning()
stopAllMovementAnims()
runTrack:Play(0.2)
end
– Camera Shake effect
local shakeIntensity = 0
local baseCFrame = camera.CFrame
local function startCameraShake()
if cameraShakeConnection then return end
local t = 0
cameraShakeConnection = RunService.RenderStepped:Connect(function(dt)
t += dt * 8
local offset = Vector3.new(
math.sin(t * 2.5) * shakeIntensity,
math.cos(t * 3.5) * shakeIntensity / 2,
0
)
camera.CFrame *= CFrame.new(offset)
end)
end
local function stopCameraShake()
if cameraShakeConnection then
cameraShakeConnection:Disconnect()
cameraShakeConnection = nil
end
end
local function tweenShake(target)
task.spawn(function()
local step = (target > shakeIntensity) and 0.01 or -0.01
while math.abs(shakeIntensity - target) > 0.01 do
shakeIntensity += step
task.wait(0.02)
end
shakeIntensity = target
end)
end
– Running / Walking logic
local function beginRunning()
if isRunning then return end
isRunning = true
humanoid.WalkSpeed = RUN_SPEED
startRunning()
startCameraShake()
tweenShake(0.15)
end
local function endRunning()
if not isRunning then return end
isRunning = false
humanoid.WalkSpeed = WALK_SPEED
stopAllMovementAnims()
stopTrack:Play(0.05)
stopTrack.Stopped:Wait()
startWalking()
tweenShake(0)
task.wait(0.3)
stopCameraShake()
end
– Jump handling
humanoid.StateChanged:Connect(function(_, state)
if state == Enum.HumanoidStateType.Jumping then
stopAllMovementAnims()
jumpTrack:Play(0.1)
elseif state == Enum.HumanoidStateType.Landed then
if isRunning then
startRunning()
else
startWalking()
end
end
end)
– Shift handling
UserInputService.InputBegan:Connect(function(input, processed)
if processed then return end
if input.KeyCode == Enum.KeyCode.LeftShift then
beginRunning()
end
end)
UserInputService.InputEnded:Connect(function(input)
if input.KeyCode == Enum.KeyCode.LeftShift then
endRunning()
end
end)
– Respawn handling
player.CharacterAdded:Connect(function(char)
character = char
humanoid = char:WaitForChild(“Humanoid”)
animator = humanoid:WaitForChild(“Animator”)
end)
Movement Fix (local script in starterplayerscripts):
– LocalScript in StarterPlayerScripts
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild(“Humanoid”)
local idleTime = 1 – seconds to wait before stopping animations
local currentIdle = 0
– Store currently playing animations
local playingAnimations = {}
– Listen to animations being played
humanoid.AnimationPlayed:Connect(function(track)
table.insert(playingAnimations, track)
end)
– Check movement every 0.1 seconds
spawn(function()
while true do
wait(0.1)
if humanoid.MoveDirection.Magnitude == 0 then
currentIdle = currentIdle + 0.1
if currentIdle >= idleTime then
– Stop all playing animations after 3 seconds idle
for _, track in ipairs(playingAnimations) do
if track.IsPlaying then
track:Stop()
end
end
– Clear the table so we don’t try to stop old tracks repeatedly
playingAnimations = {}
end
else
currentIdle = 0 – reset idle timer when moving
end
end
end)
---- SOOO basically the movement fix just stops all animations when idle because i suck at this with animations and stuff:
– i had a showcase video but forums doesnt let me upload large videos SO SORRY
