#How do I equip a tool to a dummy?

1 messages · Page 1 of 1 (latest)

whole folio
#

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.

glossy peak
#

any errors?

whole folio
#

Everything runs fine

#

Right now I think it's just that things aren't updated the same inside of a viewportframe

#

I'm not sure why that would be, but seems things to work outside of it

#

So I'm going to just render outside the viewportframe and then move it in

#

Mm that didn't work

#
local viewport = script.Parent
local itemFolder = viewport:WaitForChild("Item")
local tool = itemFolder:FindFirstChildOfClass("Tool")
local dummy = viewport:WaitForChild("Dummy")

dummy.Parent = workspace
dummy.PrimaryPart = dummy:FindFirstChild("HumanoidRootPart")
dummy:SetPrimaryPartCFrame(CFrame.new(0, 1000, 0))

local newTool = tool:Clone()
newTool.Parent = dummy

local humanoid = dummy:FindFirstChildOfClass("Humanoid")
if humanoid then
    humanoid:EquipTool(newTool)
end

task.wait(2)

dummy.Parent = viewport
dummy:SetPrimaryPartCFrame(CFrame.new(0, 0, 0))

local camera = Instance.new("Camera")
camera.Parent = viewport
viewport.CurrentCamera = camera

local hrp = dummy.HumanoidRootPart
local distance = 8
local cameraPosition = hrp.Position + Vector3.new(distance * 0.7, 2, distance * 0.7)

camera.CFrame = CFrame.lookAt(cameraPosition, hrp.Position + Vector3.new(0, 1, 0))
glossy peak
whole folio
#

It runs all the way

#

Even sets the camera position

#

The dummy just doesn't equip the tool

glossy peak
whole folio
#

That's the plan at this point

glossy peak
#

it's unfortunate, but not that much of a delay on progress

whole folio
#

Yeah saw the same

#

Thank you still

nova osprey
# whole folio That's the plan at this point
Although they will be equipped, Tools for which Tool.RequiresHandle is true will not function if they have no handle, regardless if this method is used to equip them or not.

did you by any means forgot that? 🤔

whole folio
#

The tool does have a handle

uncut whale
#

wait

#

uh

#

idk

wheat lynx
#

Humanoid:equiptool(tool)

desert pendant
#

your tool needs a handle