Viewport frames and sound effects on the server glitching out

iIm currently making a game on my alt account but in studio, when I turned the graphics to highest, the viewport frames look like this:

Screen Shot 2021-11-26 at 2.48.21 PM

for me, whenever I set the graphics to max, this buggy pixel thing appears on the viewport frame

also, if you join the game when your graphics are already set to max, it doesn’t show, but if you set it to low and THEN max again, it appears

the sounds also used to glitch out when playing while I was testing, but for some reason it just stopped?

I am on a Mac and the game link is > this

Can you provide you’re code being used in the ViewPortFrame. (Also by any chance is the model in the viewport very far away from the world centre as that causes these sorts of errors)

the code is this:

local ply = game.Players.LocalPlayer

repeat wait() until ply.Character ~= nil
local character = ply.Character

local root = character:WaitForChild("HumanoidRootPart")

local playergui = ply:WaitForChild("PlayerGui")
local healthgui = playergui:WaitForChild("HealthGui")

local visual = healthgui:WaitForChild("visual")
local viewportframe = visual:WaitForChild("ViewportFrame")

local runservice = game:GetService("RunService")
local tweenservice = game:GetService("TweenService")

local tween = tweenservice:Create(viewportframe, TweenInfo.new(3, Enum.EasingStyle.Cubic, Enum.EasingDirection.InOut), {ImageTransparency = 0})

tween:Play()

local camera = Instance.new("Camera")

local clonedchar = nil

viewportframe.CurrentCamera = camera

ply.CharacterAdded:Connect(function(ncharacter)
	root = ncharacter:WaitForChild("HumanoidRootPart")
	character = ncharacter
	viewportframe.ImageTransparency = 1
	tween:Play()
end)

runservice.RenderStepped:Connect(function()
	if character ~= nil then
		if clonedchar ~= nil then
			clonedchar:Destroy()
		end
		local model = Instance.new("Model", viewportframe)
		local children = character:GetChildren()
		for _, child in pairs(children) do
			if not child:IsA('LocalScript') and not child:IsA('Script') and not child:IsA("Folder") then
				if child:IsA("Humanoid") then
					child.DisplayDistanceType = "None"
				end

				local clone = child:Clone()

				if child:IsA('BasePart') then
					clone.CanCollide = false
				elseif child:IsA("Accessory") or child:IsA("Tool") then
					for _, descend in pairs(clone:GetDescendants()) do
						if descend:IsA("Sound") or descend:IsA("Script") or descend:IsA("LocalScript") then
							descend:Destroy()
						end
					end
				end
				clone.Parent = model
			end
		end
		clonedchar = model
		camera.CFrame = CFrame.new((root.CFrame.LookVector * 9)+(root.CFrame.RightVector * 4)+root.Position,root.Position)
	end
end)

and in the explorer it looks like this:
Screen Shot 2021-11-26 at 4.17.34 PM
the script is called “status bar”, and the character view is in viewport frame

ignore the tween stuff and healthgui is parented to startergui

I tried taking the guis and parent it to healthgui and it still is glitchy, maybe it could be just a studio bug?

How far away from 0,0,0 is the character model?

it depends on where the character is, if the character’s position is 4, 0, 0 then the viewmodel character’s position will be 4, 0, 0, the camera just points to the character’s head

edit: just realized the map is really far from 0, 0, 0

Yeah, when the character is a few hundred thousand studs away from 0,0,0 then it can start glitching out like this, how far away was the screenshot above taken?

current position is -120.989, -209.35, -477.982

535 studs away

In that case it should be a problem with the distance, are you rendering the full map in the viewport, if so that could be putting to much pressure on the viewport.

it is rendering only the character, when I set the spawn’s position to 0, 0, 0, the bug still continues

holdon, while testing. It appears that my other friends don’t see the issue on their pc, I guess it could be a Mac only bug?

In that case it likely is just an issue with your device.