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

'Attempt to call a table value'?

Let's say that I want to move a cloned text to a random UDim2 position.

local randomX = math.random(0.158,0.616)
local randomY = math.random(0.09,-0.091)
	
textClone.Position = UDim2(randomX,0,randomY,0)

Looks fine, until the output said:

Players.rayhansatria.PlayerGui.StrengthAddGui.LocalScript:9: attempt to call a table value

I was calling a random number value, not a table value. Any ideas?

1 answer

✓ Accepted answer

Your problem is that you are using float integers (numbers that contain decimals) instead of whole numbers. math.random() only supports whole numbers, althought there are ways you can get around this (i would recommend having a look at the devforum, etc.).

For example:

math.random(0.1,0.2)

will error, but:

math.random(1,2)

will not error.

Accept this if it worked/helped!

1 comment

0

Thanks!

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