Hey, I have a problem with my local script for an ability upgrade, i need help asap bc my game is launching in less then 7 hours, please help, i keep getting this error:
Players.yololol2006.PlayerGui.Ability.Ability_Shop.Ability.DoubleCoins.Inner.Upgrade!.LocalScript:17: attempt to compare nil <= number
this is my code:
local upgradePrices = {100,250,600,1000,2500,4500,7500}
local cooldownTimes = {20,15,13,10,7,5,3}
local function get()
script.Parent.Upgrds.OnClientEvent:Connect(function(upgrds)
script.Parent.Parent["AFK VLOGS"].Text = string.format("AFK VLOGS (%u VLOGS)",upgradePrices[upgrds])
print(upgrds)
return upgrds
end)
end
script.Parent.MouseButton1Click:Connect(function()
local upgrds = get()
local plr = game.Players.LocalPlayer
print(upgrds)
if plr.leaderstats.Vlogs.Value >= upgradePrices[upgrds] then
if plr.PlayerGui.Clicker:WaitForChild("AFrontShadeFree") then
plr.PlayerGui.Clicker:WaitForChild("AFrontShadeFree"):Destroy()
plr.leaderstats.Vlogs.Value = plr.leaderstats.Vlogs.Value - upgradePrices[upgrds]
plr.PlayerGui.Clicker.CoolDown.Value = cooldownTimes[upgrds + 1]
script.Parent.Upgrds:FireServer(upgrds + 1)
else
plr.leaderstats.Vlogs.Value = plr.leaderstats.Vlogs.Value - upgradePrices[upgrds]
plr.PlayerGui.Clicker.CoolDown.Value = cooldownTimes[upgrds + 1]
script.Parent.Upgrds:FireServer(upgrds + 1)
end
elseif upgrds >= 4 then
script.Parent.Text = "Max upgrade!"
end
end)