Character viewer

Hello, I have a question, how can i create a character viewer like meepcity?

ezgif.com-gif-maker (1)

2 Likes

You can make a viewport for the player, or just clone your character there if you really want to. (I recommend viewport.) and then you’ll have to know about Mouse, Mouse.hit to know how to get the mouse position in 3D space, after you will have to learn CFrames | Roblox Creator Documentation to know how to move the object in 3d space

Script works, but i have error in line 23 here line code:

cam.CFrame = CFrame.Angles(0, math.rad(mouseHit), 0) * CFrame.new(hrp.Position + (hrp.CFrame.LookVector * 5.5), hrp.Position)

Can you show what the error says?

Here all code:

local ViewPortFrame = script.Parent:WaitForChild("ViewPortFrame")

local Character = game.Players.LocalPlayer.Character or game.Players.LocalPlayer.CharacterAdded:Wait()
Character.Archivable = true

local Mouse = game.Players.LocalPlayer:GetMouse()

local MouseHit = Mouse.Hit.p

local Camera = Instance.new("Camera")
Camera.Parent = ViewPortFrame

ViewPortFrame.CurrentCamera = Camera

local CloneChar

game:GetService("RunService").RenderStepped:Connect(function()

	if CloneChar then CloneChar:Destroy() end

	CloneChar = Character:Clone()

	local HumanoidRootPart = CloneChar:WaitForChild("HumanoidRootPart")

	Camera.CFrame = CFrame.Angles(0, math.rad(MouseHit), 0) * CFrame.new(HumanoidRootPart.Position + (HumanoidRootPart.CFrame.LookVector * 5.5), HumanoidRootPart.Position)

	CloneChar.Parent = ViewPortFrame

end)

Why are you setting MouseHit to math.rad? And why are you even using it?

Your MouseHit returns a Vector3, while math.rad can only accept a single number.

local MouseHit = Mouse.Hit.p

Positions are always returned in Vector3.
You have to choose a single axis, if you’re gonna use math.rad.

And I’m not sure if getting the position once only is what you wanna do, but local variables only saves the position once, meaning you’re only assigning your Mouse.Hit.p position to MouseHit once, instead, you should make it a global variable by removing the “local” and just keeping it as “MouseHit = Mouse.Hit.p”

I want to rotate a model in ViewportFrame by dragging mouse

Have you read this solution yet?

Ok, thank for help and i should use that

No problem, lemme know if you need help. :slight_smile: :+1:

1 Like