Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

I have a problem with this exp system.. What is its problem ?

Asked by 5 years ago
Edited 5 years ago

this is my code.. when my character Exp value turns into 1000, it does not level up ! help me !

local DataServer = game:GetService("DataStoreService"):GetDataStore("Data")

--Stats

game.Players.PlayerAdded:connect(function(Player) Player.CharacterAdded:connect(function(Character) local key = "id-"..Player.userId

local Stats = Instance.new("IntValue", Player) Stats.Name = "PlayerData"

--Level

local Level = Instance.new("IntValue", Stats) Level.Name = "Level" Level.Value = 1

--Max Value

local MaxLevel = Instance.new("IntValue", Stats) MaxLevel.Name = "MaxLevel" MaxLevel.Value = 99

--Experience

local Exp = Instance.new("IntValue", Stats) Exp.Name = "Exp" Exp.Value = 0

--Experience Exp needed

local Expn = Instance.new("IntValue", Stats) Expn.Name = "ExpNeeded" Expn.Value = 1000

--Changed Stuff BB

Exp.Changed:connect(function() --This doesnt work if Exp.Value >= Expn.Value then print("Level up") Level.Value = Level.Value + 1 Exp.Value = 0 Expn.Value = Expn.Value + 1000 end end)

Answer this question