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

Not being able to call function(s)?

I've never really understood the way function calling works. In some of my games, trying to call mutiple function will cause the game to only call one specific function. What's with that!

And I've ran into this problem yet again. There are no errors in the output, but when I try to call the two functions at lines 58 - 62, only "DisplayPI()" works. If all the lines of code over welms you ;), only focus on the lines where a function is called. THX!!!

function DisplayPI(back,Primary)
	wait()
	print("PI")
	local x = 0
	local y = 0
	local var = 0
	while player ~= nil do
		wait()
		var = var + 1
		x = x + 1
		y = x
		back["Column" .. Index].Text = back["Column" .. Index].Text .. string.sub(Primary,x,y)
		if var >= 65 then
			var = 0
			Index = Index + 1
			print(Index)
			if Index == 8 then
				print("J")
			end
		end
	end
end

function ScrollColumns(back)
	print("HELLO")
	repeat wait() until Index >= 8
	local var = 0
	while player ~= nil do
		repeat wait() until var >= 60 or var == 0
		for i=1,60 do
			wait(1/30)
			var = var + 1
			for i,v in pairs(back:GetChildren()) do
				v.Position = v.Position + UDim2.new(0,0,-.001,0)
				if v.Position.Y.Scale <= -.1 then
					v:Destroy()
				end
			end
		end
	end
end

function LoadColumns(back)
	print("PI")
	local var = -.1
	for i=1,10 do
		var = var + .1
		Instance.new("TextLabel",back).Size = UDim2.new(1, 0, 0.1, 0)
		back.TextLabel.Position = UDim2.new(0, 0 ,var ,0)
		back.TextLabel.BackgroundTransparency = 1
		back.TextLabel.FontSize = Enum.FontSize.Size18
		back.TextLabel.Text = ""
		back.TextLabel.TextXAlignment = Enum.TextXAlignment.Left
		back.TextLabel.Name = "Column" .. (tostring(var*10))
	end
	repeat wait() until var >= .8
	print("j")
	DisplayPI(back,player.Backpack.Primary.Value)
	print("jl")
	ScrollColumns(back)
	print('jks')
end

1 answer

✓ Accepted answer

The issue is that you have a while loop in your DisplayPI function, and it never breaks. If you still want a loop, but the rest of the functions to continue, I believe you can use coroutines.

2 comments

0

Btw did you enjoy Pi day?

0

@LaterLace Oyes I did. Thanks for asking!

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