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

How do I compare with return value instead of just "function"?

I'm trying to compare a number (pos) with another number (returned by getComp()). I get this error: Workspace.Part.Script:28: attempt to compare number with function. Line 28 is the one with > . What am I doing wrong?

function getComp(vector, comp)
	return 1
end

function split(part, pos, axis)
	-- Test input
	
	if (pos > getComp(part.size, axis)) then
		print("pos too large")
	end
end

1 comment

0

pos is most likely a function because getCom() is returning an integer. 

2 answers

✓ Accepted answer

I'm not actually getting any errors using your function, copied, with tests of split(Instance.new("Part"), 1, 1) and split(Instance.new("Part"), 10, 1)

Copy the full script?

1 comment

0

Thanks for the quick answer!

I figured it out. I was calling split() like this:

split(part, split, axis)

The problem was i used the same name for a variable and a function (split). I changed it and now I'm getting some other wierd error: startScript re-entrancy has exceeded 3 . Probably an unrelated issue though.

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