✓ Accepted answer
print has no return value.
Since it lacks a return value, res is assigned to nil.
If you want, you can concatenate the results into a single string, and display the text that way, or maybe format it kinda like this.
local function bhask(a, b, c)
local delta = b^2 - 4*a*c;
local x1 = (-b - math.sqrt(delta))/(2*a);
local x2 = (-b + math.sqrt(delta))/(2*a);
return x1, x2;
end
local frame = script.Parent.Parent;
local a, b, c = frame.A, frame.B, frame.C;
local x1, x2 = bhask(a.Text, b.Text, c.Text);
frame.Result.Text = string.format("X1: %d | X2: %d", x1, x2);
Notice how cleaner it is. Use variables if you will be repeatedly using script.Parent.Parent, or anything really.
I'm not exactly sure what you want the result to be, but you can modify this to your needs.
Also if you read RobloxWhizYT's comment don't worry he's just being a big dum dum like always and doesn't know functions
1 comment
Thx