Viewport Frame does not like me. (was: Spooky Scary Sentient Floating Hats in the Viewport frame)

I’m trying to make a Character Viewport that’s still separate from the Player’s Character (kind of like a “mind of it’s own”).

The hats are possessed… not really. The hats are just following the REAL player while still in the Viewport and not properly attaching to the Viewport Character, instead attaching to the Workspace Character.

I’ve tried to reset the CFrame to see if it- didn’t work.
I then tried to delay the script so that it had time to registe- didn’t work.
Okay, so maybe I should try to manua- no.

This is what I’ve got so far, minus some extra code that’s not related to the issue.

local VP = script.Parent:WaitForChild("ViewportFrame")
local WM = VP:WaitForChild("WorldModel")
local VPChar = WM:WaitForChild("ViewportCharacter")
local Char = game.Players.LocalPlayer.Character or game.Players.LocalPlayer.CharacterAdded:Wait()
while task.wait(0) do
	for i,v in VPChar:GetChildren() do
		if v:IsA("Accoutrement") then
			if not table.find(Char:GetChildren(),v.Name) then
	for i,v in Char:GetChildren() do
		if v:IsA("Accoutrement") then
			if not table.find(VPChar:GetChildren(),v.Name) then
				local hat = v:Clone()
				hat.Parent = VPChar

I’m still relatively new to coding and UI, and this probably isn’t the best- in fact probably the worst way to go about something like this, but I hope it’ll improve over time.


Line 13 you put Char instead of VPChar
Same for line 8, that might be the problem


That caused the player to lose all their accessories, and because of the order it was in the Viewport Character didn’t have find any children of VPChar.


Maybe I got the problem, it seems like it’s still welded to the Player, so if the weld is child of the accessory it should keep all the info, you should either destroy the weld and make a new one with the correct info or directly change the parts welded


That seems to have fixed the problem, thanks!

I also just remembered that Humanoid Descriptions exist…
That would’ve definitely helped to remember.

1 Like

Happy you fixed the problem, sorry for the dumb take I said before, I had my brain turned off, and maybe you could also try with humanoid descriptions obviously


Update: I’m still suffering.
I tried a different way to go about updating the ViewportCharacter because it wasn’t working and I found another weird issue…
As soon as the CharacterAdded event fires the entire script just stops.

Please put your code in ``` so we can browse it easily, it seems like what you did is a bit counterproductive, it is a bit messy, try:

    local VPChar = --what you wrote
    local character = player.Character or player.CharacterAdded:Wait()
    outfit = Hum:GetAppliedDescription()
1 Like

This script isn’t working, the Viewport/HumanoidDescription does not update to any changes on the current Character model so I’m going to try a different method.

Alright, so I’m beginning to believe there is nothing I can really do about the situation of the Viewmodel Character not updating to changes on the original Character…

I’m gonna paste the script here if anyone can somehow miraculously find the answer to the problem though.

local RepS = game:GetService("ReplicatedStorage")
local Player = game:GetService("Players").LocalPlayer
local thespot = Player.PlayerGui:WaitForChild("PlayerDisplay"):WaitForChild("Frame"):WaitForChild("ViewportFrame"):WaitForChild("WorldModel")
local VPChar = RepS:WaitForChild("ViewportCharacter"):Clone()
VPChar.Parent = thespot
local Character = Player.Character or Player.CharacterAdded:Wait()
local Hum = Character:WaitForChild("Humanoid")
local VPHum = VPChar:WaitForChild("Humanoid")
while task.wait() do
	local Desc = Hum:GetAppliedDescription()

here’s the Place too with the GUI
the miraculous updating viewport experiment - failing.rbxl (66.5 KB)

Try adding some print statements and tell us which work, and remove the solution, so people will help

1 Like

I think the script is working as intended, but I don’t think the game is behaving the way I wanted it to for it to work.

Could you show how it works? Maybe we could help more

1 Like

I’m trying to make a UI for customizing your avatar, and I wanted to have a display that shows your character on the menu while you customize (I wanted UI to cover full screen but if I can’t get this to work I might have to resort to making panels and leaving the middle clear).

also the UI is supposed to be way bigger but I just shrank it while I developed the actual script.

You must update it when the child gets changed, so you check for a ChildRemoved event

1 Like

At this point I’m just gonna have to delay on this feature, because nothing really worked. Thanks for all your help though! I’ll take a closer look next time and see that I get this done properly.

1 Like

Why not just make the camera follow the character and move the character to the position instead of holding it in the center? Also ApplyDescription would only work if you modified the HumanoidDescriptions themselves versus changing it by parenting a new hat, etc…

1 Like