I’ve been experiencing for past days. So the problem is that, when i switch to server-side, animations will get messy, but when i switch back to client it goes back to normal. Seems odd to me because this is my first time experiencing this. Here’s the code if you would mind:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local shared_modules = ReplicatedStorage.SharedModules
local shared_settings = shared_modules.Settings
local shared_utilities = shared_modules.Utilities
local shared_classes = shared_modules.Classes
local animations = ReplicatedStorage.Animations
local combat_animations = animations.CombatAnimations
local CombatSettings = require(shared_settings.CombatSettings)
local default_ids = {
["idle"] = "rbxassetid://14677434626";
["walk"] = "rbxassetid://14797575707";
}
local function setNewCharacterAnimations(character, animationsTable: {[string]: string})
local animate_script = character:WaitForChild("Animate")
for _, v in animate_script:GetChildren() do
if animationsTable[v.Name] then
local animation: Animation = v:FindFirstChildWhichIsA("Animation")
if animation then
animation.AnimationId = animationsTable[v.Name]
end
end
end
end
local function resetCharacterAnimations(character)
local animate_script = character:WaitForChild("Animate")
for _, v in animate_script:GetChildren() do
if default_ids[v.Name] then
local animation: Animation = v:FindFirstChildWhichIsA("Animation")
if animation then
animation.AnimationId = default_ids[v.Name]
end
end
end
end
local function configure(character)
character.ChildAdded:Connect(function(child)
if child:IsA("Tool") then
local _settings = CombatSettings[child.Name]
if not _settings then return end
if _settings.NotAvailable then return end
local anims = {}
for _, v in _settings.Animations.Character do
anims[string.lower(v)] = combat_animations[child.Name][v].AnimationId
end
setNewCharacterAnimations(character, anims)
end
end)
character.ChildRemoved:Connect(function(child)
if child:IsA("Tool") then
resetCharacterAnimations(character)
end
end)
end
Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(configure)
end)
The Video: