The string value inside the Instance.new() function is incorrect, you have it as “IntValue” change it to “Folder”
I copied you exact script and pasted it after Player.leaderstats.Exp and changed “name” to “Value” and it didn’t work. Did I do something wrong?
Player.leaderstats.Exp.Changed:Connect(function(Value)
local RequiredExp = Player.leaderstats.Level.Value * 100 + 100
if Player.leaderstats.Exp.Value == RequiredExp or Player.leaderstats.Exp.Value >= RequiredExp then
Player.leaderstats.Exp.Value -= RequiredExp
Player.leaderstats.Level.Value += 1
end
end)
Wait i just realized it was the devforum doing it automatically “”
The example script is a generic example which had typos originally, just keep name and wrap all the code in the .changed with an if name = value.
I did this, I don’t really know what you mean. If you wrote that one part of the script for me that would probably fix it.
Player.leaderstats.Exp.Changed:Connect(function(name)
local RequiredExp = Player.leaderstats.Level.Value * 100 + 100
if Player.leaderstats.Exp.Value == RequiredExp or Player.leaderstats.Exp.Value >= RequiredExp then
Player.leaderstats.Exp.Value -= RequiredExp
Player.leaderstats.Level.Value += 1
end
end)
I’m not really an advanced scripter.
Player.leaderstats.Exp.Changed:Connect(function(name)
if name == "Value" then
local RequiredExp = Player.leaderstats.Level.Value * 100 + 100
if Player.leaderstats.Exp.Value >= RequiredExp then
Player.leaderstats.Exp.Value -= RequiredExp
Player.leaderstats.Level.Value += 1
end
end
end)
Doesn’t work. I don’t know what to do honestly and i’m probably gonna go to bed so I’ll just figure it out tomorrow but thanks for the help. I’ll be online for like 10 more mins.
Geez yeah I guess that makes sense. Goodnight and idk why it’s broken
Goodnight, I guess we can figure it out tomorrow.
This might sound dumb, but check if the script is disabled
also where is the script???
It’s enabled for sure. I would be dumb enough to not check though
its located in server script service
im gonna go to bed gnight yall
Does the Exp in the leaderboard change at all?
I updated a few things in your script. I changed Exp.Value.Changed to Exp.Changed, added some variables, and used them correctly (so instead of player.leaderstats.Exp.Changed, I just did Exp.Changed).
Code:
--//Services
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
--//Variables
local LeaderstatsEvents = ReplicatedStorage.LeaderstatsEvents
local LevelUp = LeaderstatsEvents.LevelUp
local RankUp = LeaderstatsEvents.RankUp
--//Tables
local CodesInfo = {
Code1 = "Coins25",
Code2 = "Coins50",
Code3 = "Gems5",
}
--//Functions
Players.PlayerAdded:connect(function(Player)
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = Player
local Level = Instance.new("IntValue")
Level.Name = "Level"
Level.Parent = leaderstats
local Exp = Instance.new("IntValue")
Exp.Name = "Exp"
Exp.Parent = leaderstats
local Coins = Instance.new("IntValue")
Coins.Name = "Coins"
Coins.Parent = leaderstats
local Gems = Instance.new("IntValue")
Gems.Name = "Gems"
Gems.Parent = leaderstats
--Other--
local Rank = Instance.new("StringValue")
Rank.Name = "Rank"
Rank.Parent = Player
--Quests--
local QuestStats = Instance.new("Folder")
QuestStats.Name = "QuestStats"
QuestStats.Parent = Player
local QuestNum = Instance.new("IntValue")
QuestNum.Name = "QuestNum"
QuestNum.Value = 1
QuestNum.Parent = Player
local QuestInProgress = Instance.new("BoolValue")
QuestInProgress.Name = "QuestInProgress"
QuestInProgress.Parent = Player
--Quest Stats--
local TimePlayed = Instance.new("IntValue")
TimePlayed.Name = "TimePlayed"
TimePlayed.Value = 0
TimePlayed.Parent = QuestStats
--Codes--
local Codes = Instance.new("Folder")
Codes.Name = "Codes"
Codes.Parent = Player
for codeName, codeReward in CodesInfo do
local newCode = Instance.new("BoolValue")
newCode.Name = codeName
newCode.Parent = Codes
local newReward = Instance.new("BoolValue")
newReward.Name = "Reward"
newReward.Value = codeReward
newReward.Parent = newCode
end
--Stats--
local PlayerStats = Instance.new("Folder")
PlayerStats.Name = "PlayerStats"
PlayerStats.Parent = Player
--Boosts--
local Boosts = Instance.new("Folder")
Boosts.Name = "Boosts"
Boosts.Parent = Player
local CoinsBoost = Instance.new("IntValue")
CoinsBoost.Name = "CoinsBoost"
CoinsBoost.Value = 0
CoinsBoost.Parent = Boosts
local GemBoosts = Instance.new("IntValue")
GemBoosts.Name = "GemsBoost"
GemBoosts.Value = 0
GemBoosts.Parent = Boosts
--Update Log and Tutorial--
local Updates = Instance.new("Folder")
Updates.Name = "Updates"
Updates.Parent = Player
local Tutorial = Instance.new("BoolValue")
Tutorial.Name = "Tutorial"
Tutorial.Value = true
Tutorial.Parent = Updates
local BETA = Instance.new("BoolValue")
BETA.Name = "BETA"
BETA.Parent = Updates
--Client Events--
Level.Changed:Connect(function()
LevelUp:FireClient(Player)
end)
Rank.Changed:Connect(function()
RankUp:FireClient(Player)
end)
--Level System--
Exp.Changed:Connect(function(newExp)
local RequiredExp = Level.Value * 100 + 100
if newExp >= RequiredExp then
Exp.Value -= RequiredExp
Level.Value += 1
end
end)
end)
I’m just going to point something out, Value objects (IntValue, NumberValue, StringValue, etc…) only fire .Changed when their Value is changed anyways, so don’t worry about GetPropertyChangedSignal (it’s redundant.)
Also try wrapping arithmetic to ensure proper execution of arithmetic (somewhat redundant but may help)
local RequiredExp = (Player.leaderstats.Level.Value * 100) + 100
Also, your first check is redundant. You are using greater than OR equal (>=) to in your second check in the if statement, so you don’t need the equal to (==) check.
Didn’t fix it. I don’t know what to do.
No errors?
Nope. No errors at all. Nothing seems to be working.