This is kind of a simple question, but nothing seems to work.
I have a dummy which is fully rigged and inside of a viewport-frame. I'm trying to show off weapons by equipping them to the dummy inside of the viewport-frame.
local viewport = script.Parent
local itemFolder = viewport:WaitForChild("Item")
local tool = itemFolder:FindFirstChildOfClass("Tool")
local dummy = viewport:WaitForChild("Dummy")
dummy.PrimaryPart = dummy:FindFirstChild("HumanoidRootPart")
dummy:SetPrimaryPartCFrame(CFrame.new(0, 0, 0))
local newTool = tool:Clone()
local handle = newTool:FindFirstChild("Handle")
if handle then
handle.Anchored = false
handle.CanCollide = false
end
task.wait(0.1)
local humanoid = dummy:FindFirstChildOfClass("Humanoid")
if humanoid then
humanoid:EquipTool(newTool)
end
local camera = Instance.new("Camera")
camera.Parent = viewport
viewport.CurrentCamera = camera
local hrp = dummy.HumanoidRootPart
local size = dummy:GetExtentsSize()
local offset = math.max(size.X, size.Z)
camera.CFrame = CFrame.new(
hrp.Position + Vector3.new(offset, size.Y * 0.5, offset),
hrp.Position + Vector3.new(offset, size.Y * 0.5, offset)
)
This is the script. Nothing is anchored.
I can provide more information if that's needed to solve the problem.