So I am currently trying to make a game and I am in need of remote events. The problem is that it is not getting the fire on the server. I am trying to fire a remote event on a local script when the player clicks a gui button. On the server I want it to run a function when the remote event is fired. I have looked at a article already but I am not finding it useful I might just be doing it wrong.
When you want to fire a remote event you have to do it from a client script by saying that path of the remote event and doing :FireServer() also inside the brackets you can send optional data.
Then in a server script you also say the path of the remote event and then say .OnServerEvent:Connect(function(player)
and put code here you want to do.
If you want any more help please provide some more information to help you
local tempAfkButton = script.Parent.TextButton
tempAfkButton.MouseButton1Up:Connect(function()
afkEvent:FireServer()
end)
Server script
local afkEvent = game.ReplicatedStorage:WaitForChild(“AfkEvent”)
local idle = {}
local playing = {}
afkEvent.OnServerEvent:Connect(function(player)
print(player.Name…" has fired this event")
end)
I think then it should be fine. This is getting printed in the server not the client. So when you go in the server in the dev console it doesn’t get printed?