local ReplicatedStorage = game:GetService("ReplicatedStorage")
local cloverEvent = ReplicatedStorage:WaitForChild("Clover")
local gameModule = require(ReplicatedStorage:WaitForChild("ModuleScript"))
local luckTables = gameModule.luckMultipliers
local random = Random.new()
local function determineNewLuck(currentLuck)
for i = currentLuck + 1, #luckTables do
local chance = luckTables[i].changeToGet
if random:NextNumber() <= chance then
return i
end
end
return currentLuck
end
cloverEvent.OnServerEvent:Connect(function(plr)
print("cloverEvent Fired!")
local plrData = plr:WaitForChild("leaderstats")
local plrLuck = plrData:WaitForChild("Luck")
local plrMoney = plrData:WaitForChild("Money")
if plrLuck.Value >= 0 and plrLuck.Value < #luckTables then
print("Found luck value")
local currentLuck = plrLuck.Value
local newLuck = determineNewLuck(currentLuck)
if newLuck > currentLuck then
print("Player " .. plr.Name .. " has obtained new luck level: " .. newLuck)
plrLuck.Value = newLuck
else
print("Player " .. plr.Name .. " did not obtain new luck.")
end
else
print("Player " .. plr.Name .. " has an invalid Luck level, luck level: " .. plrLuck.Value)
end
end)
I want it like a level system but its luck level, only if player is lucky enough so they can level up
why does it it jump from luck level 1 to luck level 4 and it does that until luck level 70, also the luck are not realistic, it always level up even it skip the level, pls help