So for my game, I'm trying to make a GUI which allows users to enter the ID of a sound and fire it to the server
game:GetService("Players") script.Parent.MouseButton1Click:Connect(function() local player = game.Players.LocalPlayer local id = script.Parent.Parent.ThemeId.Text game.ReplicatedStorage.DataSaveEvent:FireServer(id) end)
This is the Localscript that acts as a Save button, ThemeId is a TextBox which allows the user to enter the Id
game.ReplicatedStorage.DataSaveEvent.OnServerEvent:Connect(function(id) print(id) end)
This is the server event, it gets picked up correctly, but when I check the output, it prints my Username instead of the text in the TextBox. Anyone see the issue?
The first parameter of a RemoteEvent/RemoteFunction is always the player who fired it.
This should fix your code:
game.ReplicatedStorage.DataSaveEvent.OnServerEvent:Connect(function(player, id) print(id) end)