local plr = game.Players.LocalPlayer

local rs = game:GetService("ReplicatedStorage")
local remote = rs.Remotes.RemoteFolder:WaitForChild("Prestige")
local frame = script.Parent.Parent.Parent.PrestigeStepTwo
local current = script.Parent.Parent.Parent.Prestige
local intval = plr.leaderstats.Level
local prestige = plr.Stats.Prestige

script.Parent.Accept.MouseButton1Down:Connect(function()
	if tonumber(intval.Value) >= 1 then
		remote:FireServer("First")
	elseif prestige.Value == 1 and tonumber(intval.Value) >= "I -1" then	
		remote:FireServer("Second")
	end
end)

script.Parent.Decline.MouseButton1Down:Connect(function()
	frame.Visible = false
	current.Visible = true
end)

Basically, in console, it's saying that "11: attempt to compare string to nil" why am I getting this issue and how can I fix it? Also, on line 13, am I doing that line properly or am I doing something wrong? And also, it's firing the event that is changing my Level value

2 comments

0

Well, when using tonumber(), it returns nil when the argument can't be converted into a number. So that's your error I'm guessing.

0

What can I do to properly make it work?