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?
(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)
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
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.