-
What do you want to achieve? I want to understand why its giving me a warning here
-
What is the issue? I opened up my script to see this warning, which has never been there before and i haven’t made any changes to the script
-
What solutions have you tried so far? I have tried searching up what the warning means but i couldnt find anything
Function which the warning is given:
local PurchaseUpgrade = function(UpgradeId)
local Bought = false
local Island = UpgradeDataModule[UpgradeId]
if not Island then return end
local IslandInstance = IslandTable[Island]
local IslandData = IslandTable[Island .. "Data"]
local UpgradeData = require(IslandInstance["Upgrade" .. UpgradeId])
local UpgradeInstance = IslandData[UpgradeId]
local LevelInstance = game.ReplicatedStorage.Values.Upgrades:FindFirstChild("Upgrade" .. UpgradeId)
if LevelInstance == nil then
if UpgradeData["Prices"][1] <= game.ReplicatedStorage.Values.Points.Points.Value then
LevelInstance = Instance.new("NumberValue", game.ReplicatedStorage.Values.Upgrades)
LevelInstance.Name = "Upgrade" .. UpgradeId
else
return
end
end
local Level = LevelInstance.Value
if Level == #UpgradeData["Prices"] then return end
if UpgradeData["PriceType"] == "Points" then
if UpgradeData["Prices"][Level + 1] <= game.ReplicatedStorage.Values.Points.Points.Value then
Bought = true
game.ReplicatedStorage.Values.Points.Points.Value -= UpgradeData["Prices"][Level + 1]
Level += 1
LevelInstance.Value += 1
local BuyEffect = game.ReplicatedStorage.Effects.Buy.HolderPart.Attachment:Clone()
BuyEffect.Parent = UpgradeInstance.Display
BuyEffect.ParticleEmitter.Color = ColorSequence.new(UpgradeInstance.Display.Color)
task.spawn(function()
for i = 1, 4 do
BuyEffect.ParticleEmitter:Emit(10)
task.wait(0.02)
end
task.wait(1)
BuyEffect:Destroy()
end)
UpdateUpgradeBoost(UpgradeData, UpgradeId, Level)
end
end
if Bought == true then
UpdateUpgrade(UpgradeId)
end
end
Whole script:
local CollectionService = game:GetService("CollectionService")
local IslandTable = {
["Island1"] = script.Island1,
["Island1Data"] = require(script.Island1),
["Island2"] = script.Island2,
["Island2Data"] = require(script.Island2),
["Island3"] = script.Island3,
["Island3Data"] = require(script.Island3),
}
local UpgradeDataModule = require(script.UpgradeData)
local CompactNumber = require(game.ReplicatedStorage.Modules.CompactNumber)
local UpdateUpgradeBoost = function(UpgradeData, UpgradeId, Level)
if UpgradeData["BoostType"] == "Points" then
if UpgradeData["SubType"] == "Additive" then
game.ReplicatedStorage.Values.Points.Generation["Additive"]["Upgrade" .. UpgradeId].Value = UpgradeData["BoostAmount"][Level]
return
end
if UpgradeData["SubType"] == "Multiplicative" then
game.ReplicatedStorage.Values.Points.Generation["Multiplicative"]["Upgrade" .. UpgradeId].Value = UpgradeData["BoostAmount"][Level]
return
end
end
if UpgradeData["BoostType"] == "WalkSpeed" then
if UpgradeData["SubType"] == "Add" then
game.ReplicatedStorage.Values.WalkSpeed.WalkSpeed.BoostAmount["Upgrade" .. UpgradeId].Value = UpgradeData["BoostAmount"][Level]
return
end
end
if UpgradeData["BoostType"] == "Unlock" then
game.ReplicatedStorage.Values.Unlock[UpgradeData["SubType"]].Value = true
return
end
if UpgradeData["BoostType"] == "Producer" then
if UpgradeData["SubType"] == "Amount" then
game.ReplicatedStorage.Values.Producers.Amount["Upgrade" .. UpgradeId].Value = UpgradeData["BoostAmount"][Level]
return
end
if UpgradeData["SubType"] == "Cooldown" then
game.ReplicatedStorage.Values.Producers.Cooldown.Multiplicative["Upgrade" .. UpgradeId].Value = UpgradeData["BoostAmount"][Level]
return
end
end
end
local UpdateUpgrade = function(UpgradeId)
local Island = UpgradeDataModule[UpgradeId]
if not Island then return end
local IslandInstance = IslandTable[Island]
local IslandData = IslandTable[Island .. "Data"]
local UpgradeData = require(IslandInstance["Upgrade" .. UpgradeId])
local UpgradeInstance = IslandData[UpgradeId]
local LevelInstance = game.ReplicatedStorage.Values.Upgrades:FindFirstChild("Upgrade" .. UpgradeId)
local Level = 0
if LevelInstance then
Level = LevelInstance.Value
end
if Level ~= 0 then
UpgradeInstance.Display.SurfaceGui.UpgradePrice.Text = CompactNumber["AbbreviateNumber"](CompactNumber.Abbreviations, UpgradeData["Prices"][Level + 1] or UpgradeData["Prices"][Level]) .. " " .. UpgradeData["PriceType"]
UpgradeInstance.Display.SurfaceGui.UpgradeCount.Text = "(" .. Level .. "/" .. #UpgradeData["Prices"] .. ")"
if Level == #UpgradeData["Prices"] then
UpgradeInstance.Display.SurfaceGui.UpgradePrice.Text = "Maxed"
end
for i, v in ipairs(UpgradeData["Unlocks"]) do
local UpgradeIsland = UpgradeDataModule[v]
UpgradeIsland = game.Workspace.Islands[UpgradeIsland]
local ModelToMove = UpgradeIsland.Upgrades["Upgrade" .. v]
if game.ReplicatedStorage.Values.Upgrades["Upgrade" .. UpgradeId] then
if game.ReplicatedStorage.Values.Upgrades["Upgrade" .. UpgradeId].Value > 0 then
game.ServerStorage.Events.DisplayUpgrade:Fire(ModelToMove, UpgradeData["UnlocksPortal"], UpgradeData["PortalDirectory"])
end
end
end
end
end
local PurchaseUpgrade = function(UpgradeId)
local Bought = false
local Island = UpgradeDataModule[UpgradeId]
if not Island then return end
local IslandInstance = IslandTable[Island]
local IslandData = IslandTable[Island .. "Data"]
local UpgradeData = require(IslandInstance["Upgrade" .. UpgradeId])
local UpgradeInstance = IslandData[UpgradeId]
local LevelInstance = game.ReplicatedStorage.Values.Upgrades:FindFirstChild("Upgrade" .. UpgradeId)
if LevelInstance == nil then
if UpgradeData["Prices"][1] <= game.ReplicatedStorage.Values.Points.Points.Value then
LevelInstance = Instance.new("NumberValue", game.ReplicatedStorage.Values.Upgrades)
LevelInstance.Name = "Upgrade" .. UpgradeId
else
return
end
end
local Level = LevelInstance.Value
if Level == #UpgradeData["Prices"] then return end
if UpgradeData["PriceType"] == "Points" then
if UpgradeData["Prices"][Level + 1] <= game.ReplicatedStorage.Values.Points.Points.Value then
Bought = true
game.ReplicatedStorage.Values.Points.Points.Value -= UpgradeData["Prices"][Level + 1]
Level += 1
LevelInstance.Value += 1
local BuyEffect = game.ReplicatedStorage.Effects.Buy.HolderPart.Attachment:Clone()
BuyEffect.Parent = UpgradeInstance.Display
BuyEffect.ParticleEmitter.Color = ColorSequence.new(UpgradeInstance.Display.Color)
task.spawn(function()
for i = 1, 4 do
BuyEffect.ParticleEmitter:Emit(10)
task.wait(0.02)
end
task.wait(1)
BuyEffect:Destroy()
end)
UpdateUpgradeBoost(UpgradeData, UpgradeId, Level)
end
end
if Bought == true then
UpdateUpgrade(UpgradeId)
end
end
for i, v in pairs(CollectionService:GetTagged("Upgrade")) do
local ClickDetector = Instance.new("ClickDetector", v.Display)
ClickDetector.MouseClick:Connect(function()
PurchaseUpgrade(tonumber(string.sub(v.Display.SurfaceGui.UpgradeNumber.Text, 2, 5)))
end)
end
game.ServerStorage.Events.UpdateAllUpgrades.Event:Connect(function(UpgradesToUpdate)
if UpgradesToUpdate == nil then return end
for Name, Value in pairs(UpgradesToUpdate) do
local UpgradeId = tonumber(string.sub(Name, 8, #Name))
local LevelInstance = game.ReplicatedStorage.Values.Upgrades:FindFirstChild("Upgrade" .. UpgradeId)
local Level = LevelInstance.Value
local Island = UpgradeDataModule[UpgradeId]
local IslandInstance = IslandTable[Island]
local UpgradeData = require(IslandInstance["Upgrade" .. UpgradeId])
UpdateUpgradeBoost(UpgradeData, UpgradeId, Level)
UpdateUpgrade(UpgradeId)
end
end)
Without making any changes to the code, it suddenly switched to looking like this and doesnt show any warning message. I have no idea why that happened
Structure incase needed:
Hope anyone can help me with this!