How to make this server-sided? (URGENT!)

Please help im trying to play an animation when the tool is activated.

local tool = script.Parent
local anim = tool:WaitForChild("Throwanim")
local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local humanoid = char:WaitForChild("Humanoid")
local loadanim = humanoid:LoadAnimation(anim)

tool.Activated:Connect(function()
	if not loadanim.IsPlaying then
		loadanim:Play()
	end
end)
1 Like

Client Animation replicates to server automatically, you don’t need to use a remote event or port it serverside to show the animation to server.

So it is already server sided?

Basically yes, but only for client sided animations.

So would my script work on serverside?

No, what I meant was playing a client animation in client (local script) replicates on server.
So you CANT just script this on serverside. but you can just keep it as local script.

As @TheESPPlayerSeemoney said, animations played on the client are automatically replicated to the server.

It is possible to play the animation from a server script; however, this behavior is not recommended. When animations are played on the server they hog up vital memory that the server could be using for more important tasks. Server-sided animations also appear choppy to many players due to the latency difference. If something can be done reliably on the client, keep it on the client.

Hope this tip helped! :slight_smile:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.