Problems with ViewportFrame and SurfaceGui

Hello everyone! I’ve been trying to make like a preview of my character interface. This have worked very well and then I tried to put on a SurfaceGui on the charater which is displayed on the UI. This SurfaceGui where a Frame in is is not displaying at the character in the UI. Anyone knows how I would fix this?
Everything visible btw.

The script for this is getting basiclly the SurfaceGui from the main player but this is still not working:

local Players = game:GetService("Players")
game.Players.LocalPlayer.Character:WaitForChild("Humanoid")
local character = game.Players.LocalPlayer.Character or game.Players.LocalPlayer.CharacterAdded:Wait()
character:WaitForChild("UpperTorso")
character.UpperTorso:WaitForChild("SurfaceGui")
local function CloneCharacter(char)
	char.Archivable = true
	local plrchar = char:Clone()
	char.Archivable = false
	return plrchar
end

local viewportFrame = script.Parent
local PlayerCharacter = CloneCharacter(character)
PlayerCharacter.Parent = viewportFrame.WorldModel

local viewportCamera = Instance.new("Camera")
viewportFrame.CurrentCamera = viewportCamera
viewportCamera.Parent = viewportFrame
viewportCamera.CFrame = CFrame.new(PlayerCharacter.HumanoidRootPart.Position - Vector3.new(0, 0, 6)) * CFrame.Angles(0, math.rad(180), 0)

--PlayerCharacter:WaitForChild("SurfaceGui")
--PlayerCharacter.SurfaceGui.Parent = PlayerCharacter.UpperTorso

while wait(1) do
	if character then
		if PlayerCharacter:FindFirstChild("SurfaceGui") then
			PlayerCharacter.SurfaceGui.Parent = PlayerCharacter.UpperTorso
		end
		character.UpperTorso:WaitForChild("SurfaceGui")
		local copyOfShirt = character.UpperTorso.SurfaceGui:Clone()
		PlayerCharacter.UpperTorso.SurfaceGui:Destroy()
		copyOfShirt.Parent = PlayerCharacter.UpperTorso
	end
end

This character which is going to be visible is located in a WorldModel which is located in the Viewport Frame

Many thanks,
Div

1 Like

I believe WorldModel and ViewportFrame does not render other UIs within them. Would like to see a update where they could implement SurfaceUI into it as I like to create custom textures for characters with SurfaceUI.

2 Likes