I'm messing around with RemoteEvents at the moment, trying to get a better understanding of how it works. But I don't exactly understand why button is returning nil?
local button = script.Parent button.MouseButton1Click:Connect(function() print(button) game:GetService("ReplicatedStorage").TestEvent:FireServer(button) end)
local repStorage = game:GetService("ReplicatedStorage") local event = repStorage:WaitForChild("TestEvent") event.OnServerEvent:Connect(function(player, button) print(player, button) end)
The output is Player1 nil
It is returning nil because the player gui is not accessible by the server. You can, however fire it with the button's name (button.Name).