RemoteEvents/RemoteFunctions not working

Hello! I am having problems with RemoteEvents/RemoteFunctions. When I fire an event from the client/server, the other side doesn’t respond at all and there aren’t any errors in the output. Here is my code:

client:

script.Parent.PetNamer.TextButton.MouseButton1Click:Connect(function()
	game.ReplicatedStorage.NamePet:FireServer(script.Parent.PetNamer.TextBox.Text)
	script.Parent.PetNamer.Visible = false
end)

server:

game.ReplicatedStorage.NamePet.OnServerEvent:Connect(function(player, name)
	print(name)
	local pet = CS:GetTagged(player.Name .. " Pet")[1]
	local filteredText
	local success, errorMessage = pcall(function()
		filteredText = textservice:FilterStringAsync(name, player.UserId):GetChatForUserAsync(player.UserId)
	end)
	if not success then
		warn("Error filtering text:", name, ":", errorMessage)
		filteredText = "[An error occured while filtering this text]"
	end
	pet.Name = filteredText
end)

I have no idea what is happening and I’ve tried troubleshooting in different places with print(), and the only result I have gotten is that the opposite of the side I’m firing the event on doesn’t do anything when the event is fired.

where is the serverscript in? it must be in serverscriptservice to run, or in workspace

1 Like

Have you checked if there even is a NamePet on the server side? Are you using the correct “RemoteEvent”? Give a picture of the output, and the explorer. Also I suggest that you put the remote event inside the localscript, then put the serverscript inside the remote event.

1 Like

the script is in serverscriptservice

did you try printing when the button is clicked in the localscript

Sorry my computer is really weird with screenshots so I cant send one of those but the serverscript is n serverscriptservice, the NamePet remoteevent is in replicatedstorage, and the localscript is in startergui

yes, it works and the rest of the code inside the button clicked event works

and it doesn’t print anything on the server?

Why can you not put the RemoteEvent inside the localscript, and then the ServerScript in the remote event?

--localscript
local RemoteEvent = script.NamePet
--Serverscript
local RemoteEvent = script.Parent

serverscripts dont run on client side

no its very confusing (char limit)

Bro, putting a serverscript into a localscript doesn’t make it stop working. It is still going to work exactly the same, just that it has a different parent.

I just tried it and it works thanks! I just realized how dumb I sounded I completely forgot that players are still on serverside for some reason lol. Im still kinda confused on why it wouldn’t work in serverscriptservice tho