Hey there, so I’m trying to get this developer product to 2x your leaderstat called “Time” it functions completely fine but instead of doubling it, its quadrupling it, I did some basic maths to figure this out
The script is parented to a folder under workspace, should be no issues.
Here is the code:
local datastoreService = game:GetService("DataStoreService")
local mps = game:GetService("MarketplaceService")
local player = game:GetService("Players")
local datastore = datastoreService:GetDataStore("Time")
local devproductid = 1621734615
game.Players.PlayerAdded:Connect(function(player)
mps.ProcessReceipt = function(receiptInfo)
if receiptInfo.ProductId == devproductid then
player.leaderstats.Time.Value = player.leaderstats.Time.Value * 2
end
end
end)
I’ve gotten no errors within the output.
I’ve tried adding the current value onto it but it still does it. I tried doing it by instead of “player.leaderstats.Time.Value = player.leaderstats.Time.Value * 2” I did: “player.leaderstats.Time.Value = player.leaderstats.Time.Value + player.leaderstats.Time.Value”
Any help is appreciated.
I might be a bit dumb as I’m not a math wizard so this could just be a silly mistake but still help is appreciated.
I would say that’s probably your issue. Fire a remote when the button is pressed and prompt the purchase on the server, as well as handling everything there versus in a playerAdded event and tell me how that works
You’re defining the player as Game.Players, which could be causing some weird interference as well.
(There’s no need for this variable as it seems you are using game.Players.PlayerAdded either way)