Cant really figure out how to get the player to appear in gui correctly

I’m having trouble moving the character appearing on the gui to be closer to the camera. I keep changing numbers of the vector3, but i can’t actually figure out how to place it correctly.

Server script

local Players = game:GetService("Players")

local function onPlayerAdded(player) 
	local team = player.Team
	local function onCharacterAdded(character)
		character.Archivable = true
		local cloned = character:Clone()
		cloned.Parent = game.ReplicatedStorage.LocalCloning

		character.Archivable = false
	end

	player.CharacterAdded:Connect(onCharacterAdded)
end

Players.PlayerAdded:Connect(onPlayerAdded)

Local Script

repeat task.wait() until game:IsLoaded()
local Players = game:GetService("Players")

local player = Players.LocalPlayer

local viewportFrame = script.Parent
local rig = game.ReplicatedStorage.LocalCloning:WaitForChild(player.Name)
rig.Parent = viewportFrame

local viewportCamera = Instance.new("Camera")


viewportFrame.CurrentCamera = viewportCamera
viewportCamera.Parent = viewportFrame

--rig.CFrame = CFrame.new(Vector3.new(0, 2, 12))
viewportCamera.CFrame = CFrame.new(Vector3.new(0, 2, 12), rig.HumanoidRootPart.Position)

I’m very bad with placement and CFrame stuff, sorry if this is a dumb question

Update: Okay I kinda figured it out but the player keeps appearing like this

It is a possibility it is being cloned before your character fully loads. Try using CharacterAppearanceLoaded and see if that helps.

Regardless, any reason why you wouldn’t just do all of this on the client instead of relying on the server?

I dont know how to do it on the client and i tried CharacterAppearanceLoaded but it still appears as that
im attempting client rn, give me a second

Its working way worse on client for me, the player position moves around every time i start the game despite the code being the same as the code in the script (just making it look for just the local player and not a joined player) and when i tried to fix it it just stopped appearing

Can you post your current code?

Oops hi i fixed it, heres my code
But now im facing a new problem, I can’t get the cloned character to play any animations

repeat task.wait() until game:IsLoaded()

local Players = game:GetService("Players")
local player = Players.LocalPlayer
local viewportFrame = gui.Frame.Player

local function onCharacterAppearanceLoaded(character)
	task.wait(2)
	character.Archivable = true
	local cloned = character:Clone()
	cloned.Parent = viewportFrame
	local anims = script.Animations:FindFirstChild("None")
	if anims ~= nil then
		local playanim = cloned.Humanoid.Animator:LoadAnimation(anims.walk)
		playanim:Play()
	end

	character.Archivable = false

	local rigcframe = game.ReplicatedStorage.LocalCloning.Rig.PrimaryPart.CFrame
	cloned:SetPrimaryPartCFrame(rigcframe)
	
	characterdisplay = cloned

end

local function onCharacterAdded(character)
	if character:IsDescendantOf(workspace) then
		onCharacterAppearanceLoaded(character)
	else
		character:WaitForChild("Humanoid")
		character:WaitForChild("HumanoidRootPart")
		player.CharacterAppearanceLoaded:Connect(onCharacterAppearanceLoaded)
	end
end
player.CharacterAdded:Connect(onCharacterAdded)

if player.Character then
	onCharacterAdded(player.Character)
end

As you can see there is a play animation thing in the script, however ithe character doesnt play any animation

Try reading the animation documentation, this should help because I believe you arent getting the animations correctly

[Using Animations | Documentation - Roblox Creator Hub](https://anim documentation)

1 Like

That cant be right because if i change the target to the player it works fine, and i copied locad animation code from other scripts that do work