can you show me a screen shot of everything in the leaderboard
leaderboard? (character limit lolololol)
also it seems like youre trying to replicate the coins from the server to the client? but aslong as you change the coins from the server it will automatically replicate to all the clients. so there is no need to be sending the coins to the server and sending it back.
Yeah but how will it get the price of the item the player doesnt have enough for, because they’re all different.
yes, this portion of the script:
game.Players.LocalPlayer.leaderstats.Coins.Value
because maybe the coins arent even in leaderstats, thats the only way for it to keep returning nil.
I know where everything is and it’s getting the correct value
whats all different?(fillin the limit)
What do you mean by that? (char)
actualy nvm all this try this
local Coins = (game.Players.LocalPlayer.leaderstats.Coins.Value + 200 )* -1
game.ReplicatedStorage.ErrorEvents.NotEnoughCoins:FireServer(Coins)
attempt to compare nil < number (Character limit)
okay try this
game.ReplicatedStorage.ErrorEvents.NotEnoughCoins.OnClientEvent:Connect(function(...)
print({...})
local Coins250 = 1339932370
local Coins1000 = 1339932367
local Coins2500 = 1339932369
local Coins10000 = 1339932368
local Values = {{250,Coins250}, {1000,Coins1000}, {2500,Coins2500}, {10000,Coins10000}}
local ClosestTo = math.abs(MissingCoins)
local FetchCount = 1
local n=#Values
for i = 1,n do
if ClosestTo<Values[1][1] then
local abc={Values[1][1], math.abs(ClosestTo - Values[1][1]),Values[1][2]}
table.insert(Values,abc)
end
table.remove(Values,1)
end
table.sort(
Values,
function(a, b)
return a[2] < b[2]
end
)
for i = 1, FetchCount do
game:GetService("MarketplaceService"):PromptProductPurchase(game.Players.LocalPlayer, Values[i][3])
end
end)``
I’m guessing "… is just supposed ot be MissingCoins
Now it’s not doing anything. (Chars)
yes and no ...
is supposed to be any and all arguments passed into the function. so were going to see if the coins are succefully being sent over.
can you show me the output
Sure thing
saopgnasdpogfnapsognsaog
And also am I supposed to keep the modified version of the first script you sent me?
invalid argument #1 to ‘abs’ (number expected, got nil), it printed “{}” and then "{…}
The player
argument is passed in automatically in the OnServerEvent
function, so you only need to pass in the Coins
value when you call FireServer
.
so yeah the coins isnt being sent to the client
go back and print coins in all the places youre interacting with it to see where it dissapears and thats the issue