OK, I have this script that calculates the area of a circle from values. Script:

P = 3.141592653
R = script.Parent.Parent.Radi 


function CalculateArea()
print'starting'
wait()
A = (P * R)
wait()
A2 = A*A
print'calculated'
print (A2)
end

script.Parent.ClickDetector.MouseClick:connect(CalculateArea)

-- Output : Workspace.Model.E.Script:9: attempt to perform arithmetic on global 'R' (a userdata value)

Not too sure what it means?

2 comments

0

R is a roblox instance. The equivalent of that operation could also be 1 +game.Workspace, which of course is something Lua cannot calculate. What is "R"? Is it a NumberValue? In that case, R = script.Parent.Parent.Radi.Value

0

Ah thanks, simple thing I seemed to have missed.