RemoteEvents always send the Player who fired the event as first argument.
That’s strange, I’ve never encountered issues with that, I thought only HTTP Requests and DataStores have a option to toggle them.
I have another hypothesis, this may be caused due to Server binding OnServerEvent after Client :FireServer()
s it. This issue is possible in ROBLOX Studio, as Studio has a weird script running order. In a real game, this issue will not happen as Server runs before Client.
You could also try to create the remotes from server, using :WaitForChild() in Client, and only set the Parent of the remotes once you’ve binded the OnServerEvent/OnServerInvoke events to a function.
I had an issue with this but the reverse - I was firing a remote event from the server but the client sometimes wasn’t receiving it. It seems like remote events that are used on startup need some sort of protocol to make sure the client is listening to it at the time it is called. Likely for you, the client is acting before the server. For longer client loading times, it may be the opposite, so I don’t think creating the event on the server will do much. It seems like RemoteEvent events aren’t cached, although I would have hoped they would be…
What I recommend is using a RemoteFunction to see if the script is listening to the event, since it yields until there is a response. Then you can fire the event. But that’s also feasible just using a RemoteFunction alone. I know RemoteEvents are a lot nicer in that they don’t yield, but it is probably necessary for any events that need to fire at the start of a game.
How did you create the remote?
If you created the remote on the client, the server will not get the event signal because the remote doesn’t exist on the server.
I tested this script putting everything on the position I thought was right and it worked. Here’s the explorer:
If it’s organized in some other way try this one.
Output:
I had the same kind of issue for a while, I would double-check and make sure the Server is listening for the same event that the Client is firing.
Im having the same problem but im using a gui and all my events are in a folder in workspace. I can fire the main event to announce a message but I cannot do any other event. Very Weird
try to use a local script make it a child of the button
Try to use this…
Local script:
local Hello = game:GetService("ReplicatedStorage"):WaitForChild("Hello")
script.Parent.Screen.Frame.Button.Activated:Connect(function()
Hello:FireServer()
print("hello from client")
end)
Script:
local Hello = game:GetService("ReplicatedStorage"):WaitForChild("Hello")
Hello.OnServerEvent:Connect(function(player)
print("hello from server")
end)
That wouldn’t make a single difference apart from the use of waitforchild
which obviously isnt the issue
try removing the player parameter
I did it my way, and it worked!
It’s very simple and there are better ways to do it
-
Local script:
-
ServerScriptService:
-
Explorer:
-
Output:
test it in the real game
Plublish go play and press F11 then click on server
How about you change the local script to:
script.Parent.Screen.Frame.Button.MouseButton1Click:Connect(function()
game.ReplicatedStorage.Hello:FireServer()
print("hello from client")
end)
this should work
I used to have this problem, make sure the script isnt in replicated storage
i am having the same issue, but there’s a strange behavior whenever i move the local script inside a screengui, it just doesn’t work and this is for team test
here’s a video of it working normally
and here’s a video of it being tested regularly and then team test
here’s a video to show that the script is parented to gui and it doesn’t work then it works when i unparent the script
The reason is because you changed the script’s Parent. Another way around this is using player.PlayerGui. Can you show me the code and the explorer? If you do I can solve your problem.
it works normally when you test it, but if you team test it then the remote event won’t fire
but i was messing around and put the script outside of the screen gui and it works like normal, but the exception i can’t use the screen gui
i don’t know what i did, but its fixed now
i just find it strange that it broke like that in the first place and not only that it worked when testing regularly but when i team test it broke
Did you test on a local server or just via play? if you tested via a local server then the output wont be in the local player but in the server