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

Why is my ModuleScript function timing out?

Repost cause the previous question got no anwers.

function Window.render(Buffer)
	if Buffer == nil then
		Window.getWidth()
		Window.getHeight()
		for i=1,Window.Width + Window.Height do
			local Pixel = Instance.new("Frame")
			Pixel.Size = UDim2.new(0, 1, 0, 1)
			Pixel.BorderSizePixel = 0
			Pixel.Position = UDim2.new(0, i-(i*math.floor(i/Window.Width)), 0, math.floor(i/Window.Width))
			Pixel.BackgroundColor3 = Color3.new(0, 0, 0)
			Pixel.Parent = Window.getInstance()
		end
	else
		for i=1,#Buffer do
			local Pixel = Instance.new("Frame")
			Pixel.Size = UDim2.new(0, 1, 0, 1)
			Pixel.BorderSizePixel = 0
			Pixel.Position = UDim2.new(0, Buffer[i]["Index"].X, 0, Buffer[i]["Index"].Y)
			Pixel.BackgroundColor3 = Buffer[i]["Color"]
			Pixel.Parent = Window.getInstance()
		end
	end	
end

function Window.isCloseRequested()
	
end

function Window.getWidth()
	Window.Width = game.Players.LocalPlayer.PlayerGui.Render.Frame.AbsoluteSize.X
end

function Window.getHeight()
	Window.Height = game.Players.LocalPlayer.PlayerGui.Render.Frame.AbsoluteSize.Y
end

function Window.getInstance()
	Window.Instance = game.Players.LocalPlayer.PlayerGui.Render.Frame
end

Excerpt of the whole script

The script times out on line 4, not line 3 though despite the fact they are basically the same thing. This is being called from a LocalScript.

Also I'm 90% sure I'm returning stuff wrong since ive never really used ModuleScripts before. If it is wrong please let me know.

1 comment

0

Ask this at the devforum, they will definitely answer you.

1 answer

for i=1,#Buffer do wait()
	local Pixel = Instance.new("Frame")
	Pixel.Size = UDim2.new(0, 1, 0, 1)
	Pixel.BorderSizePixel = 0
	Pixel.Position = UDim2.new(0, Buffer[i]["Index"].X, 0, Buffer[i]["Index"].Y)
	Pixel.BackgroundColor3 = Buffer[i]["Color"]
	Pixel.Parent = Window.getInstance()

i added wait try this now

1 comment

0

i just noticed there is a low chance you will see this answer

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