How could i change this to server script code?

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    So i found this old script that someone gave me but i think it needs fe but idk how to use fe with animations and dont get me started on mouse
  2. What is the issue? Include screenshots / videos if possible!
    It doesnt rlly work which i think is due to FE
  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    couldnt even find one
    After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
    its a tool if you need the model here
    animation.rbxm (4.2 KB)
local plr = game.Players.LocalPlayer
local anims = {script.Parent.Hold, script.Parent.Swing}
local loadedAnims = {}
local tool = script.Parent
local animator
local debounce = true
local del = 2

tool.Equipped:Connect(function()
	script.Parent.Handle.Transparency = 1
end)

tool.Equipped:Connect(function(mouse) --On tool equipped do:
	animator = plr.Character:WaitForChild("Humanoid"):WaitForChild("Animator") --Find the animator object
	if not loadedAnims[1] then --If the animation wasn't loaded before
		loadedAnims[1] = animator:LoadAnimation(anims[1]) --Load it
	end
	loadedAnims[1]:Play()	--Play it
	
end)

--Click animation:
tool.Activated:Connect(function()
	if(debounce) then --Setting up the debounce (cooldown)
		debounce = false
		animator = plr.Character:WaitForChild("Humanoid"):WaitForChild("Animator") --Find the animator object
		if(not loadedAnims[2]) then --If the animation didn't exist yet
			loadedAnims[2] = animator:LoadAnimation(anims[2]) --Load it
		end
		loadedAnims[2]:Play() --Play it
		
		wait(del) --Wait the cooldown
		debounce = true
	end
end)

tool.Unequipped:Connect(function()
	loadedAnims[1]:Stop() 
	if(loadedAnims[2]) then 
		loadedAnims[2]:Stop()
	end
end)

Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

This should work, just make it a script instead of a localscript

local anims = {script.Parent.Hold, script.Parent.Swing}
local loadedAnims = {}
local tool = script.Parent
local animator
local debounce = true
local del = 2

tool.Equipped:Connect(function()
	script.Parent.Handle.Transparency = 1
end)

tool.Equipped:Connect(function(mouse) --On tool equipped do:
	local char = script.Parent.Parent
	local plr = game.Players:GetPlayerFromCharacter(char)
	animator = plr.Character:WaitForChild("Humanoid"):WaitForChild("Animator") --Find the animator object
	if not loadedAnims[1] then --If the animation wasn't loaded before
		loadedAnims[1] = animator:LoadAnimation(anims[1]) --Load it
	end
	loadedAnims[1]:Play()	--Play it

end)

--Click animation:
tool.Activated:Connect(function()
	local char = script.Parent.Parent
	local plr = game.Players:GetPlayerFromCharacter(char)
	if(debounce) then --Setting up the debounce (cooldown)
		debounce = false
		animator = plr.Character:WaitForChild("Humanoid"):WaitForChild("Animator") --Find the animator object
		if(not loadedAnims[2]) then --If the animation didn't exist yet
			loadedAnims[2] = animator:LoadAnimation(anims[2]) --Load it
		end
		loadedAnims[2]:Play() --Play it

		wait(del) --Wait the cooldown
		debounce = true
	end
end)

tool.Unequipped:Connect(function()
	loadedAnims[1]:Stop() 
	if(loadedAnims[2]) then 
		loadedAnims[2]:Stop()
	end
end)

so there wasnt wrong with anything with the mouse arg?

What exactly are you trying to achieve by changing the script from client to server? if animation, it is already fe.
havent fact checked, but im pretty sure tool events are best on the client

but its not rlly working its also giving me some error you can download the model and insert it in roblox studio and see if theres any error when you keep it at its original code

I tried downloading the place you uploaded, it did not have that tool you were talking about…

but…i couldve sworn try this
animation.rbxm (4.2 KB)

Nevermind, I was using the wrong file before my bad. I Just rewrote the tool for you, hope this version is easier to use. I already tested it and it works for me.
animationtoolnew.rbxm (4.0 KB)

Animations should only be loaded and played on the client.
https://developer.roblox.com/en-us/api-reference/class/Animator

not true ive seen some scripts using remote functions to send animations to the server because if its client only you can only see it correct or did roblox change smth?

Check the link I provided, animations replicate to the server (when loaded and played from the client).

how? r6,r15? it aint workin for me

replace the ids of the animations in the animation folder with ones you made