Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why won't this server event trigger?

Both these scripts and the Remote Event are inside a Text Button

local script

local button = script.Parent
local callEvent = script.Parent:FindFirstChild("CallAnimal")

local function onButtonActivated()
	print("Requesting call")
	callEvent:FireServer()
	print("Call Sent")
end
 
button.Activated:Connect(onButtonActivated)

normal script

local function callAnimal(player)
		print("Who called?")	
end

script.Parent.CallAnimal.OnServerEvent:Connect(callAnimal)

All the script is printing is the

Requesting Call

Call Sent

Nothing is printing from the normal script (meaning the event isn't firing)

1 comment

0

-insert triggered meme here-

1 answer

✓ Accepted answer

You should put your RemoteEvents in ReplicatedStorage if you want multiple clients and a single server script to use them. Your problem is almost certainly that you have the RemoteEvent object as a child of something in StarterGui, so when the GUI is cloned onto the player instances, a new instance of the RemoteEvent is created for each player. RemoteEvents are not passed from client to server by name, the client and server have to be using the same replicated instance of the RemoteEvent object. So... as far as your server script is concerned, no one is firing the event it connected a listener to. However, each client is firing a RemoteEvent that the server is clueless about, and which will (over time) cause errors to spew in your server logs that say something to the effects of "RemoteEvent queue exhausted, did you forget to implement OnServerEvent?"

This discussion is preserved as it was. New answers, comments, and votes are closed.