I'm trying to use a remote function to pass over two player values to be saved to a lead board database. I can't get the remote event to send the values or something, but the code doesn't spit out any errors. Could someone please help me out.
Local Script:
local button = script.Parent local gui = script.Parent.Parent.Parent local text = script.Parent.Parent.TextBox local a = text.Selling local player = script.Parent.Parent.Parent.Parent.Parent local stats = player:WaitForChild("LeaderStats") local b = stats:WaitForChild("Coins") local c = stats:WaitForChild("Diamonds") text.Changed:Connect(function() b.Value = text.Text end) button.MouseButton1Down:Connect(function() if b.Value >= a.Value then b.Value = b.Value - a.Value c.Value = c.Value + a.Value * 1.5 game.ReplicatedStorage.ServerHandlers.SellEvent:FireServer(player, b, c) print(player.Name.."|Diamonds: "..c.Value.."|Coins: "..b.Value) end end)
Server Script:
--[[There is more to this script, but it's unrelated to the problem]] game.ReplicatedStorage.ServerHandlers.SellEvent.OnServerEvent:Connect(function(player) local stats = player:WaitForChild("LeaderStats") local b = stats.Coins local c = stats.Diamonds print(player.Name.."|Diamonds: "..c.Value.."|Coins: "..b.Value) end)
Currently the script in the prints show me the local stats and the server stats after the trade is completed. I'm not sure what's going on here.
In the local script where you fire server you don't need to pass the player. When talking client to server, the player value is automatically passed as the first parameter. This solution is assuming your server script's function parameters are (player, b, c) which seem to be cut off in your question, at least for me. So the game wo So try removing the player value in the fireserver part of your local script.
game.ReplicatedStorage.ServerHandlers.SellEvent:FireServer(b, c)