The player can see character in one frame, how does that work?

Hello developer, I wanted to ask how you can create such a three-dimensional character in a frame that always looks like the player at the moment. How can you achieve this, with a script or something? Could someone please explain to me how this works?

A picture how IT should Looks Like:

1 Like

You’d clone the player model and point a viewport frame at it.

3 Likes

I dont think viewport frames support the backround

1 Like

You can include the background parts in it.

2 Likes

Should it Look something like this?

(Yes i have write it with an ai because i cant Script this well)

local function setupPlayerLook(player)
    -- Check if the Playerlook frame exists in the player's PlayerGui
    local playerGui = player:WaitForChild("PlayerGui")
    local playerLookFrame = playerGui:WaitForChild("Playerlook", 10)
    
    if not playerLookFrame then
        warn("Playerlook frame not found")
        return
    end

    -- Create a ViewportFrame inside the Playerlook frame
    local viewportFrame = Instance.new("ViewportFrame")
    viewportFrame.Size = UDim2.new(1, 0, 1, 0) -- Adjust size as needed
    viewportFrame.BackgroundTransparency = 1
    viewportFrame.Parent = playerLookFrame

    -- Clone the player's character model
    local character = player.Character or player.CharacterAdded:Wait()
    local clonedCharacter = character:Clone()

    -- Remove any unnecessary parts from the cloned character (e.g., scripts)
    for _, descendant in pairs(clonedCharacter:GetDescendants()) do
        if descendant:IsA("Script") or descendant:IsA("LocalScript") then
            descendant:Destroy()
        end
    end

    -- Add the cloned character to the ViewportFrame
    clonedCharacter.Parent = viewportFrame

    -- Set up a Camera to view the model
    local camera = Instance.new("Camera")
    viewportFrame.CurrentCamera = camera
    camera.Parent = viewportFrame

    -- Position the camera to view the character
    local characterPrimaryPart = clonedCharacter.PrimaryPart or clonedCharacter:FindFirstChild("HumanoidRootPart")
    if characterPrimaryPart then
        camera.CFrame = CFrame.new(characterPrimaryPart.Position + Vector3.new(0, 5, 10), characterPrimaryPart.Position) -- Adjust position as needed
    else
        warn("Character PrimaryPart not found")
    end
end

-- Trigger the function when a player joins
game.Players.PlayerAdded:Connect(function(player)
    player.CharacterAdded:Connect(function()
        setupPlayerLook(player)
    end)
end)
1 Like

it will only work if you added a viewport frame in startergui called PlayerLook

1 Like

Ok thankyou, is that the only thing i have to do?
(Does this Script come into a localscript ore in a normal Script?)

Script is a local script as only the client should be seeing it

1 Like

it likely goes under a normal script in server script service. Or it is a local script in startergui

1 Like

You kinda have to have prior experience in scripting and gui or it will be very hard.
Even the scriot itself wont exactly work if not edited or set up properly as chat gpt improves on feedback by others

1 Like

That’s true☹️, i just kow much about making models in Blender, and Design Things, from Scripting i don’t know much. When do i have to use a Script and when do i have to use a localscript?

LocalScripts are for client side code and server Scripts are for server side code. You need to learn the basics first before taking on these kinds of tasks.

1 Like

Ok, thankyou for the informations, i will learn it.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.