[Help] Play animation

Hello, everyone!

I am trying to play some animation in client.lua (serverside). In worldwide i find this snippet, but it seems not working. Can someone help me to fight this code?) Thanks in advance.

function arrest(commandEntered, player)
	TriggerClientEvent(arrest, command, player)
	if commandEntered("/arrest" ..PlayerName) then
		local playerName = GetPlayerName(source)
		local arrestPed = TaskArrestPed(player, target)
			if IsPedBeingArrested(player) = true then
		elseif  IsPedCuffed = true then
		else cancelEvent()
Added code tags


First you can’t play animation serverside and your code is a mix of server and client side.
Second check you code you missing a end after cancelEvent() to close the the whole if statement.