Viewport Frame issues, Need help

What do you want to achieve? And what is the issue
I want to “insert” static “pictures” of my custom characters inside some Viewport Frames…

The issue is that when i open the GUI the picture won’t show up in the Viewport Frame unless i hover it with the mouse… Also the Scaling is not working with different resolutions and i don’t know how to fix that either…

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I tried some solutions i got from a Discord server but i couldn’t fit those issues…

Here some images about the issues.
Imgur
Imgur
Imgur

local Pic = script.Parent

Pic.MouseEnter:Connect(function()
	local RP = nil
	if game:GetService('ReplicatedStorage').Viewport:FindFirstChild(Pic.Name) then
		RP = game:GetService('ReplicatedStorage').Viewport:FindFirstChild(Pic.Name):FindFirstChild('ViewportTemp')
	elseif game:GetService('ReplicatedStorage').SpecialViewport:FindFirstChild(Pic.Name) then
		RP = game:GetService('ReplicatedStorage').SpecialViewport:FindFirstChild(Pic.Name):FindFirstChild('ViewportTemp')
	end
	
	if RP then
		if script.Parent.Viewport:FindFirstChild('ViewportTemp') then
			script.Parent.Viewport.ViewportTemp:Destroy()
		end
		
		local Cloned = RP:Clone()
		Cloned.Parent = script.Parent.Viewport
		script.Parent.Viewport.CamPJ.CFrame = CFrame.new(Cloned.Head.Head.Position + Cloned.Head.Head.CFrame.LookVector * 1.7 + Cloned.Head.Head.CFrame.RightVector * 0.6 + Vector3.new(0, 0.15, 0), Cloned.Head.Head.Position)	
	end
end)

Your code is literally using MouseEnter, which only activates when the mouse ENTERS the viewport frame. Also make surer the image you are using is using scale size and it you want, Image scale to fit.

Ok so i could fix the Scaling since i forgot to put all in “Scale” xD

Also what could i do to change that “MouseEnter” so the image can load automatically without hovering that viewport frame with the mouse?

Instead of having your code in

Pic.MouseEnter:Connect(function()
   --code
end)

Take the code out of that function.

1 Like

change your code to

local Pic = script.Parent

	local RP = nil
	if game:GetService('ReplicatedStorage').Viewport:FindFirstChild(Pic.Name) then
		RP = game:GetService('ReplicatedStorage').Viewport:FindFirstChild(Pic.Name):FindFirstChild('ViewportTemp')
	elseif game:GetService('ReplicatedStorage').SpecialViewport:FindFirstChild(Pic.Name) then
		RP = game:GetService('ReplicatedStorage').SpecialViewport:FindFirstChild(Pic.Name):FindFirstChild('ViewportTemp')
	end
	
	if RP then
		if script.Parent.Viewport:FindFirstChild('ViewportTemp') then
			script.Parent.Viewport.ViewportTemp:Destroy()
		end
		
		local Cloned = RP:Clone()
		Cloned.Parent = script.Parent.Viewport
		script.Parent.Viewport.CamPJ.CFrame = CFrame.new(Cloned.Head.Head.Position + Cloned.Head.Head.CFrame.LookVector * 1.7 + Cloned.Head.Head.CFrame.RightVector * 0.6 + Vector3.new(0, 0.15, 0), Cloned.Head.Head.Position)	
	end
1 Like

Ok will try that! Also thanks to both of you for helping out, much appreciated!

1 Like