Remote event not being picked up on the server-side

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!

For animations to be played on the serverside when the tool is equipped and used.

  1. What is the issue? Include screenshots / videos if possible!

The remote event to play the animation isnt being picked up on the server side.

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

I’ve made sure its using the cloned remote event, not the one in the original tool. I’ve also tried to make sure the animation exists, and I’ve tried prints. The clientsided prints work but not the serversided, but the serverside does work. I tried a print to make sure the script was working at the beginning of it and it printed, and I tried to make sure the remote event existed on the server. Still didn’t work.

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!

Client script:

local tool
local repstore = game:GetService("ReplicatedStorage")
local character

script.Parent.Equipped:Connect(function()
	tool = script.Parent
	character = script.Parent.Parent
	print("Name:"..character.Name.." Player:"..game.Players:FindFirstChild(character.Name).Name)
	script.Parent.Animation:FireServer(repstore.BroomAnims.Idle)
	print("Sent function, name:"..tool.Animation.Name.." player parent:"..script.Parent.Parent.Name)
end)

script.Parent.Unequipped:Connect(function()
	tool.Unequip:FireServer(repstore.BroomAnims.Idle)
end)

script.Parent.Activated:Connect(function()
	tool.Animation:FireServer(repstore.BroomAnims.Use)
	local HitboxClone = repstore.MopHitbox:Clone()
	HitboxClone.Parent = workspace
	HitboxClone.CFrame = character:WaitForChild("HumanoidRootPart").CFrame
	
	local partsInHitbox = workspace:GetPartsInPart(HitboxClone)
	
	for _, part in partsInHitbox do
		if part.Name == "Dirt" then
			print("dirt found!!!!")
		end
	end
	
	game.Debris:AddItem(HitboxClone,0.1)
end)

Server script:

script.Parent.Animation.OnServerEvent:Connect(function(player,animation)
	print("Got animate function")
	local Character = player.Character
	local Humanoid:Humanoid = Character:WaitForChild("Humanoid")

	local Animation:AnimationTrack = Humanoid.Animator:LoadAnimation(animation)
	
	if animation.Name == "Use" then
		script.Parent.Handle.Sweep:Play()
		Animation:Play(0,1,0.7)
	else
		Animation:Play(0,1,0.7)
	end

	script.Parent.Unequip.OnServerEvent:Connect(function(client,tool)
		print("Got unequip function")
		Animation: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.

1 Like

because the player character is usually controlled by client (local player)
you can directly play the animation from the client side, and it will replicate the animation to server and then all players

1 Like

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