Hi! So I have a script which is giving people that join a group in-game currency called “cash” only once. The script is working but only if the player did not play the game before. Like, if he join the group and then plays the game, he gets $10k, but if he play the game, then leaves and then joins the group and comes back, he is not getting it. I belive it has something to do with datastore but I’m not sure. The game is autosaving.
This is in the script that is giving money:
local money = 0
local success,err = pcall(function()
if player:IsInGroup(SaveSettings.giveCashToPlayersInGroup.groupId) then
local plrCash = playerMoney:FindFirstChild(player.Name)
if plrCash then
plrCash.Value = plrCash.Value + SaveSettings.giveCashToPlayersInGroup.cashAmount
money = plrCash.Value
end
end
end)
This is the “Settings” script:
['giveCashToPlayersInGroup'] = { --Will only be given once to new players if they joined the group
['groupId'] = 12524604, --Id of the group they must join to get cash
['cashAmount'] = 10000 --The amount of cash they will get
}