So I have a problem where my displaying script has a problem where it fails to refresh after a few second, it makes the parts without problem. Refreshes fine for a few seconds until it stops refreshing. You really need someone better at coding to fix my problem.

Server code:

--Credit antoniorigo4 and ChripCat (antoniorigo4 old username chripcat new username) if you plan to use this, he doesn't like being left out.
p = Instance.new("Part")
p.Parent = workspace
local web, plr = script.web.Value, script.plr.Value
p.Transparency = 1
p.Massless = true
p.Anchored = true
p.CanCollide = true
p.CastShadow = false
p.Locked = true
local character = game:GetService("Players")[plr].Character
local offset = character.Head.Position

local http = game:GetService("HttpService")

local w,h = 0,0
local t = 0
local t2 = 0
local clearing = false

local pixels = {}
local fps = 60
local time_interval = 1/fps/3
local last_time = tick()
local mt = 500

function swait(mode)
	t = t + 1
	if t >= mt then
		t = 0
		game:GetService("RunService").Heartbeat:Wait()
		t2 = t2 + 1
		if mode == 1 and t2 >= 5 then
			wait(0.2)
		end
	end
end

function clear()
	clearing = true
	for i,v in pairs(p:GetChildren()) do
		v:Destroy()
		swait(1)
	end
	wait(2)
	clearing = false
end

function hex2rgb(hex)
	--hex = hex:gsub("#","")
	local r = tonumber("0x"..hex:sub(1,2))
	local g = tonumber("0x"..hex:sub(3,4))
	local b = tonumber("0x"..hex:sub(5,6))
	return Color3.fromRGB(r,g,b)
end

function hex2bgr(hex)
	--hex = hex:gsub("#","")
	local r = tonumber("0x"..hex:sub(1,2))
	local g = tonumber("0x"..hex:sub(3,4))
	local b = tonumber("0x"..hex:sub(5,6))
	return Color3.fromRGB(b,g,r)
end

function fix_size(l,sizewmo)
	local ns
	local success,reason = pcall(function()
		ns = http:JSONDecode(sizewmo)
	end)
	print(reason)
	if success and ns and ns[1] and ns[2] and (w ~= ns[1] or h ~= ns[2]) and not clearing then
		w = ns[1]
		h = ns[2]
		local d = 5 -- change this for bigger or smaller screen
		local s1,s2 = w/d/w,h/d/h
		p.Position = offset+Vector3.new(0,h/d/2+3,0)
		p.Size = Vector3.new(w/d,h/d,1)
		clear()
		local ds = 6
		for Y = 1, h do
			if (p and p.Parent) and not clearing and (string.len(l) == (w*h)*ds) then else break end
			for X = 1, w do
				if (p and p.Parent) and not clearing and (string.len(l) == (w*h)*ds) then else break end
				local extra = (ds-1)
				local x = (X*ds)
				local y = ((Y-1)*(w*ds))
				local tp = y+x-extra
				local f = Instance.new('Part')
				f.Material = Enum.Material.SmoothPlastic
				f.Massless = true
				f.Anchored = true
				f.CanCollide = false
				f.CastShadow = false
				f.Locked = true
				f.Color = hex2rgb(string.sub(l,tp,tp+ds))
				f.Size = Vector3.new(1, 1, 1)
				local mesh = Instance.new("BlockMesh")
				mesh.Scale = Vector3.new(s1, s2, 1)
				mesh.Parent = f
				f.Position = p.Position + Vector3.new(-p.Size.X,p.Size.Y,0)/2 + Vector3.new(X*s1-s1/2, -Y*s2+s2/2, 0)
				f.Parent = p
				pixels[tp] = f
				swait(1)
			end
		end
		return true
	end
end

function refresh(l)
	if h > 0 and w > 0 then else return end
	local ds = 6
	for Y = 1, h do
		if (p and p.Parent) and not clearing and (string.len(l) == (w*h)*ds) then else break end
		for X = 1, w do
			if (p and p.Parent) and not clearing and (string.len(l) == (w*h)*ds) then else break end
			local extra = (ds-1)
			local x = (X*ds)
			local y = ((Y-1)*(w*ds))
			local tp = y+x-extra
			local f = pixels[tp]
			f.Color = hex2rgb(string.sub(l,tp,tp+ds))
			swait(0.025)
		end
	end
end

while p and p.Parent do
	swait(0.025)
	if tick()-last_time >= time_interval and not clearing then
		last_time = tick()
		local strlapw = http:GetAsync(web .. "data.json")
		local size,pixeldata = strlapw:match("(.+)#(.+)")
		local l
		local success,reason = pcall(function()
			l = pixeldata
		end)
		print(reason)
		if success then
			if not fix_size(l,size) then
				refresh(l)
			end
		end
	end
end