So I have a LocalScript in the player's on screen GUI and I can't get it to return the two values I want. It only returns the one that is specified first.
The LocalScript:
B1.MouseButton1Down:Connect(function()
if visible == true and player.StatsSpent.Value < player.leaderstats.Level.Value then
game.ReplicatedStorage.StatSpend:FireServer(player, 1)
end
end)
This function only returns the first value (in this example, the player). When I switch it to look like this: game.ReplicatedStorage.StatSpend:FireServer**(1, player)**, it will only return the number. I confirmed this by printing in the server script. I want it to pass the two values to the server script so I can confirm the player's identity and give them a specified number of points.
The Server Script:
game.ReplicatedStorage.StatSpend.OnServerEvent:Connect(function(amount,plr)
print("StatSpend Call Received 1")
print("plr =", plr)
print("amount =", amount)
if player.Name == plr.Name then
StatsSpent.Value = StatsSpent.Value + amount
print("StatSpend Call Received 2")
end
end)
When I return the number first in the LocalScript, then it cannot confirm the player's identity here: if player.Name == plr.Name then because plr is the number just like amount. But if I return the player first, then the score can't be increased here: StatsSpent.Value = StatsSpent.Value + amount because amount is the player just like plr.
If anyone knows where I have something wrong or if they need more information, please leave a reply.

1 comment
Thanks, this works perfectly.