RemoteEvents not firing

Hey! Quick question, why are my remote events not firing or being received?

Script:

game.Workspace.Events.AnimFired.OnServerEvent:Connect(function()
    print("Received")
	Anim:Play()
end)

When I fire it, it prints “fired” as I have stated in that script, but it does not print when it should get received.

Is this connection possibly made inside another connection in your script?

No, only this script and the script that fires the remote events, I can send the other script if you need

Where is the server script located?

Also is that the only bit of code in this script?

Yooo also why do you have your events in the workspace under something (guessing is a folder) called Events. :laughing:

1 Like

Startercharacterscripts since I need the player character.

Whole script:

local playerchar = script.Parent

local e = Instance.new("Animation")
local cheer = Instance.new("Animation")

e.Parent = script.Parent
cheer.Parent = script.Parent

e.AnimationId = 12228840392
cheer.AnimationId = 507770677

local cheeranim = script.Parent:FindFirstChild("Humanoid"):LoadAnimation(cheer)
local eanim = script.Parent:FindFirstChild("Humanoid"):LoadAnimation(e)

game.Workspace.Events.eFired.OnServerEvent:Connect(function()
	print("e received")
	eanim:Play()
end)

game.Workspace.Events.CheerFired.OnServerEvent:Connect(function()
	print("Cheer received")
	cheeranim:Play()
end)
1 Like

I have no idea, they seem to work properly until now, is it because of it being in workspace?

I’d highly recommend storing your server scripts inside ServerScriptService. If you want to get the player’s character, simply use the player parameter that roblox assigns to the player that fired the event.

event.OnServerEvent:Connect(function(player)
    local character = player.Character
end)
1 Like

No. Remote events work fine as long as they are replicated from the server to the client. Workspace is a fine place to put them.

This is a local script in StarterCharacterScripts. StarterCharacterScripts is a fine place to have scripts like this and it wouldn’t work in ServerScriptService anyways.

Can you send the Script that fires the event? Make sure it’s a Script firing your event and a LocalScript (with the code above) receiving the event.

You can check to make sure parts of your code are running with print statements. If a line of code doesn’t seem to be running, try adding print statements before it. If the next one doesn’t run, continue until you find the part that is running.

Are you getting any errors?

This should probably be WaitForChild instead of FindFirstChild

If it’s a local script then it should not have an OnServerEvent.

Yeah you’re right. I thought it was a local script because its parent is a player’s character and it plays animations. It definitely would be better to have this in ServerScriptService, that’s my bad.

1 Like

I’ll try the suggestions in a bit, thank you all so much for replying