I’m trying to change the default animation of the character during the game, but nothing i try works. here is the script:
local function UpdateCoreAnimations()
if plr.Character:FindFirstChild("Laser") and plr.Character["Laser"]:IsA("Tool") then
if _G.laserActive == true then
for _, playingTrack in pairs(animator:GetPlayingAnimationTracks()) do
playingTrack:Stop(0)
end
animModule.walkAnim = "rbxassetid://10658698711"
animModule.idleAnim = "rbxassetid://10650404838"
animateScript.run.RunAnim.AnimationId = "rbxassetid://10658698711"
animateScript.walk.WalkAnim.AnimationId = "rbxassetid://10658698711"
animateScript.idle.Animation1.AnimationId = "rbxassetid://10650404838"
loaded_anim1 = char.Humanoid:LoadAnimation(char.Animate.idle.Animation1)
loaded_anim2 = char.Humanoid:LoadAnimation(char.Animate.walk.WalkAnim)
loaded_anim3 = char.Humanoid:LoadAnimation(char.Animate.run.RunAnim)
--animateScript.Disabled = true
--animateScript.Disabled = false
elseif _G.laserActive == false then
for _, playingTrack in pairs(animator:GetPlayingAnimationTracks()) do
playingTrack:Stop(0)
end
animModule.walkAnim = "rbxassetid://00000000000"
animModule.idleAnim = "rbxassetid://11322685681"
animateScript.run.RunAnim.AnimationId = "rbxassetid://00000000000"
animateScript.walk.WalkAnim.AnimationId = "rbxassetid://00000000000"
animateScript.idle.Animation1.AnimationId = "rbxassetid://11322685681"--11322685681
loaded_anim1 = char.Humanoid:LoadAnimation(char.Animate.idle.Animation1)
loaded_anim2 = char.Humanoid:LoadAnimation(char.Animate.walk.WalkAnim)
loaded_anim3 = char.Humanoid:LoadAnimation(char.Animate.run.RunAnim)
--animateScript.Disabled = true
--animateScript.Disabled = false
end
end
end
i tried debugging it by printing the AnimationId of the WalkAnim and idle, and the AnimationId changes, but the animation is still the same in the game.
also i used a module script to change the animation id in the animate script, here is the module and the animate script:
module:
local module = {}
module.walkAnim = "rbxassetid://10658698711"
module.idleAnim = "rbxassetid://10650404838"
return module
animate script:
local replicatedStorage = game.ReplicatedStorage
local animModule = require(replicatedStorage:WaitForChild("CoreAnimVariables"))
idleAnimation = animModule.idleAnim
walkAnimation = animModule.walkAnim
local animTable = {}
local animNames = {
idle = {
{ id = idleAnimation, weight = 1 },
{ id = idleAnimation, weight = 1 },
{ id = idleAnimation, weight = 9 }
},
walk = {
{ id = walkAnimation, weight = 10 }
},
run = {
{ id = walkAnimation , weight = 10 }
},
swim = {
{ id = "http://www.roblox.com/asset/?id=507784897", weight = 10 }
},
swimidle = {
{ id = "http://www.roblox.com/asset/?id=507785072", weight = 10 }
},
jump = {
{ id = "http://www.roblox.com/asset/?id=507765000", weight = 10 }
},
fall = {
{ id = "http://www.roblox.com/asset/?id=507767968", weight = 10 }
},
climb = {
{ id = "http://www.roblox.com/asset/?id=507765644", weight = 10 }
},
sit = {
{ id = "http://www.roblox.com/asset/?id=2506281703", weight = 10 }
},
toolnone = {
{ id = "http://www.roblox.com/asset/?id=507768375", weight = 10 }
},
toolslash = {
{ id = "http://www.roblox.com/asset/?id=522635514", weight = 10 }
},
toollunge = {
{ id = "http://www.roblox.com/asset/?id=522638767", weight = 10 }
},
wave = {
{ id = "http://www.roblox.com/asset/?id=507770239", weight = 10 }
},
point = {
{ id = "http://www.roblox.com/asset/?id=507770453", weight = 10 }
},
dance = {
{ id = "http://www.roblox.com/asset/?id=507771019", weight = 10 },
{ id = "http://www.roblox.com/asset/?id=507771955", weight = 10 },
{ id = "http://www.roblox.com/asset/?id=507772104", weight = 10 }
},
dance2 = {
{ id = "http://www.roblox.com/asset/?id=507776043", weight = 10 },
{ id = "http://www.roblox.com/asset/?id=507776720", weight = 10 },
{ id = "http://www.roblox.com/asset/?id=507776879", weight = 10 }
},
dance3 = {
{ id = "http://www.roblox.com/asset/?id=507777268", weight = 10 },
{ id = "http://www.roblox.com/asset/?id=507777451", weight = 10 },
{ id = "http://www.roblox.com/asset/?id=507777623", weight = 10 }
},
laugh = {
{ id = "http://www.roblox.com/asset/?id=507770818", weight = 10 }
},
cheer = {
{ id = "http://www.roblox.com/asset/?id=507770677", weight = 10 }
},
}
(this isn’t the entire animate script, just the part that i changed)