How do i divide a number? (closed)

So i want to make a small puzzle game, with a code.

I’ve never used anything related to math in roblox.

How do i divide the Value of a NumberValue and display it on a TextLabel?

All i have in mind is this:
script.Parent.Text = game.Workspace.Code.Value / 2
But it doesn’t work.

Please ensure you answer the questions given here before posting a support thread, currently we can’t help you diagnose the problem due to a lack of information. You need to post the error(s) you’re getting and your actual code.

In general you can do division with numbers that are straight integers, or that are stored as Value’s of an instance, etc.

For example:


-- or 

local val1 = 10
local val2 = 2


-- or perhaps

local IntVal ='IntValue')
IntVal.Parent = game.ReplicatedStorage
IntVal.Value = 10

print(IntVal.Value / 2)

Roblox uses a modified version of Lua. Lua is a functional language incorporates some of the paradigms of functional programming. Functional programming languages are based upon mathematical functions. In this same respect, division is simply the / operator.

You need to do a lot more from your end before posting a thread. In addition to following the Scripting Support Category guidelines (as mentioned above), you also need to do your own debugging. This thread doesn’t have sufficient content, thus a proper response can’t be provided for you.


This is not what a functional language is. Lua is not a functional language; it’s multi paradigm with an emphasis on procedural programming and data oriented design for performance.

See Vathriel’s reply. Can’t delete this for 5 hours.


Where are you getting your definition from? This is what a functional language is. It’s a paradigm yes but it’s based upon mathematical functions and evaluations. It’s even written out that way without addressing the concepts behind functional languages.

I believe if you look specifically at you will see that in the “What is Lua” section they list several paradigms Lua uses.

As in, while Lua includes aspects of functional programming it is not itself a functional language. That same text offers four other paradigms, offers the same multi-paradigm definition.

Further under the definition of functional programming,

is a programming paradigm—a style of building the structure and elements of computer programs—that treats computation as the evaluation of mathematical functions and avoids changing-state and mutable data.

Something that is not enforced in Lua, but merely something you as the programmer can enforce.

1 Like

Right. I was doing a bit of research just now. I don’t think it’s wrong to call Lua a functional language because it incorporates that paradigm, though it’s relatively inaccurate considering the multi-paradigm aspect and Lua isn’t solely such.

Thanks for the information.

1 Like