local remotefunction = game:GetService("ReplicatedStorage").RemoteEvent
remotefunction.OnServerEvent:Connect(function(pl)
if pl:FindFirstChild("leaderstats").Rebirths.Value > 1 or pl:FindFirstChild("leaderstats").Rebirths.Value == 1 then
pl.leaderstats.Sugar.Value = pl.leaderstats.Sugar.Value + tonumber(pl.leaderstats.Sugar.Value / 10 * pl.leaderstats.Rebirths.Value)
elseif pl:FindFirstChild("leaderstats").Rebirths == 0 then
pl:FindFirstChild("leaderstats").Sugar.Value = pl:FindFirstChild("leaderstats").Sugar.Value + tonumber(pl:FindFirstChild("leaderstats").Sugar.Value / 10 * 1)
end
end)
This is in a regular script, as I heard if you give leaderstat currency in a localscript it doesn't replicate to the server. Basically that script is meant to give you currency when the remote event is fired.
The Formula:
player's current points divided by 6 times by the rebirths they have
If they have 0 rebirths, this would be the formula:
player's current points divided by 6 times by 1
If it would be times by the "rebirths" instead of "1", they would get 0 points each time because anything times 0 equals 0.
My problem is that the actual point-giving part doesn't work.
ServerScriptService.GiveMoney:4: attempt to index nil with 'Rebirths'
