So I have a problem with my ServerScript. Basically I want to value to go up by 5 every 3 second, but when the value is 5, it keep printing 5 and it got stuck.
What I want to achieve:
I want the value to add by 5 then multiply the Multiplier Value every 3 second
Profile Template Module:
local DataTemplate = {
PlayerXPMultiplier = 1,
PlayerRequireXP = 20,
PlayerCurrentXP = 0,
PlayerLevels = 1,
PlayerCash = 0,
PlayerRebirths = 0
}
return DataTemplate
Server Script:
local function SetPlayerLevel(player: Player, enable: boolean)
if enable == true then
while task.wait(3) do
local PlayerProfile = ProfileManager.Profiles[player]
if not PlayerProfile then
return
end
local RequireXPData = PlayerProfile.Data.PlayerRequireXP
local CurrentXPData = PlayerProfile.Data.PlayerCurrentXP
local XPMultiplierData = PlayerProfile.Data.PlayerXPMultiplier
local LevelsData = PlayerProfile.Data.PlayerLevels
local RebirthsData = PlayerProfile.Data.PlayerRebirths
local CashData = PlayerProfile.Data.PlayerCash
local PlayerRequireXP = player:WaitForChild('PlayerRequireXP')
local PlayerCurrentXP = player:WaitForChild('PlayerCurrentXP')
local PlayerXPMultiplier = player:WaitForChild('PlayerXPMultiplier')
local PlayerLevels = player:WaitForChild('PlayerLevels')
local PlayerRebirths = player:WaitForChild('PlayerRebirths')
local PlayerCash = player:WaitForChild('PlayerCash')
CurrentXPData += 5 * XPMultiplierData
PlayerCurrentXP.Value = CurrentXPData
print(PlayerCurrentXP, CurrentXPData, XPMultiplierData)
end
elseif enable == false then
print('Disabled level system!!')
end
end