Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

why do my number selector is not working (attempt to call a number value)?

hello i testing "if" and i tried with this

function onClicked()
   if script.Parent.Parent.Value.Value "69" then
        print ("69")
   end
   
   if script.Parent.Parent.Value.Value "420" then
		print ("420")
   end

end
script.Parent.ClickDetector.MouseClick:Connect(onClicked)

and it show this messeage

*  10:49:20.608 Workspace.BUTENTER.Script:2: attempt to call a number value - Server - Script:2   10:49:20.608 Stack Begin - Studio   10:49:20.608 Script 'Workspace.BUTENTER.Script', Line 2 - function onClicked - Studio - Script:2   10:49:20.609 Stack End - Studio*

1 answer

✓ Accepted answer
function onClicked()
   if script.Parent.Parent.Value.Value == "69" then -- == means if the number is equal to 69

        print ("69")
   end

   if script.Parent.Parent.Value.Value == "420" then
        print ("420")
   end

end
script.Parent.ClickDetector.MouseClick:Connect(onClicked)

also if script.Parent.Parent.Value.Value is IntValue, use just number without "" because "69" is a string and 69 is a number

1 comment

0

MAN ITS WORKING!

This discussion is preserved as it was. New answers, comments, and votes are closed.