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

Why won't this work when it did on another script? "attempt to perform arithmetic"

Asked by 8 years ago
Edited 8 years ago

I am not the best at scripting so I took lines 16-18 from a different script which happens to be the problem here. Someone has explained to me about values and objects but never clearly enough to be understood!

The output on studio showed this: ": attempt to perform arithmetic on local 'decal' (a nil value)" Here is the script;

-- Sodaghost13

local frame = script.Parent
local tl = frame:WaitForChild("TextLabel")
local input = frame:WaitForChild("Input")
local settings = frame:WaitForChild("Settings")
local confirm = frame:WaitForChild("Confirm")
local open = frame.Parent:WaitForChild("Open")
local baseid = "http://www.roblox.com/asset/?id="

open.MouseButton1Down:connect(function()
    frame.Visible = not frame.Visible
end)

confirm.MouseButton1Down:connect(function()
        local decal = tonumber(tostring(input.Text))
        open.Image = baseid..tostring(decal-1)
        input.Text = tostring(decal)
end)
0
IT WAS 2AM DUDE PLEASE! I even had to re-write a function because I spelled it as 'funtion', twice! :/ sodaghost1 34 — 8y
0
Looks like you attempted tonumber on something that was not a number string, which returns nil. cabbler 1942 — 8y

Answer this question