I’ve been trying for a while now to get the
player character in the GUI! I have experimented a bit with viewport frames but the only way to display the character is to clone it! But I also want to show what the player is doing. Something like in “Entry Point”. I tried to just refresh the player again per frame, which works but takes a lot of power. In addition, I think that the script could be improved!
I have already worked with viewportframes, but I want to show the player in his current form (Example: If the player equips a tool, the clone in the gui should do that too).
I made a basic one a couple of days ago, i can share it with you. As @Vibe90K said, you are cloning your character into a viewport frame every frame.
local viewPortFrame = script.Parent:WaitForChild("ViewportFrame")
local char = game.Players.LocalPlayer.Character or game.Players.LocalPlayer.CharacterAdded:Wait()
char.Archivable = true
local newCamera = Instance.new("Camera")
newCamera.Parent = viewPortFrame
viewPortFrame.CurrentCamera = newCamera
local clonedChar
game:GetService("RunService").RenderStepped:Connect(function()
if clonedChar then clonedChar:Destroy() end
clonedChar = char:Clone()
local hrp = clonedChar:WaitForChild("HumanoidRootPart")
newCamera.CFrame = CFrame.new(hrp.Position + (hrp.CFrame.LookVector * 6) + Vector3.new(0,2,0) + (hrp.CFrame.RightVector * 2), hrp.Position)
--I fiddled around with the position of the camera so you get a little bit of a side on view.
clonedChar.Parent = viewPortFrame
end)
My way shows the tools in the GUI, but i guess if you want the camera facing the way your character is in the provided image you should change the camera position to this:
@boatbomber made a script similar to what you are looking for. His script currently doesn’t display tools, but I am sure you can change that by modifying it!
I downloaded your script, tested it with 3 different tools and they were all not displayed in the ViewPortFrame. Maybe this is a problem coming from me, apologies!