I made a boxing glove gear and it only shows on one hand, any fix?
2 Likes
Instead of using a Tool
you can use RigidConstraints
and Attachments
- Create a
Attachment
in the boxing glove - Create
RigidConstraint
with aScript
like this:
local character = ...
local leftGlove = ...
local rightGlove = ...
-- define the gloves and character first
local rightHand = character:WaitForChild("RightHand")
local leftHand = character:WaitForChild("LeftHand")
local rightGripAttachment = rightHand:WaitForChild("RightGripAttachment")
local leftGripAttachment = leftHand:WaitForChild("LeftGripAttachment")
local rightGloveConstraint = Instance.new("RigidConstraint", rightHand)
rightGloveConstraint.Attachment0 = rightGripAttachment
rightGloveConstraint.Attachment1 = rightGlove.Attachment
local leftGloveConstraint = Instance.new("RigidConstraint", leftHand)
leftGloveConstraint.Attachment0 = leftGripAttachment
leftGloveConstraint.Attachment1 = leftGlove.Attachment
- Then we can load and play animations like idle and hit using the
Animator:LoadAnimation()
method
Further Reading
2 Likes
If you are using a tool, it will only be attached to the right hand. To fix this, you will need to add a script to set the CFrame of a part to where you want it to be and weld it do that part of the character.
For example, at add a boxing glove to the left hand, you would need to set the CFrame of a MeshPart/Part to the LeftHand of the character and add a WeldConstraint to attach it. This will allow it to be in the correct position and move with the character.
Hope this helps
2 Likes
Here’s an example video showing what I said before in Studio:
The instance tree:
The attachments:
GlovesGiver Script
:
local Players = game:GetService("Players")
local ServerStorage = game:GetService("ServerStorage")
local leftGloveMesh = ServerStorage.LeftGlove
local rightGloveMesh = ServerStorage.RightGlove
Players.PlayerAdded:Connect(function(player: Player)
player.CharacterAdded:Connect(function(character: Model)
local leftGlove = leftGloveMesh:Clone()
local rightGlove = rightGloveMesh:Clone()
leftGlove.Anchored = false
rightGlove.Anchored = false
local rightHand = character:WaitForChild("RightHand")
local leftHand = character:WaitForChild("LeftHand")
local rightGripAttachment = rightHand:WaitForChild("RightGripAttachment")
local leftGripAttachment = leftHand:WaitForChild("LeftGripAttachment")
local rightGloveConstraint = Instance.new("RigidConstraint", rightHand)
rightGloveConstraint.Attachment0 = rightGripAttachment
rightGloveConstraint.Attachment1 = rightGlove.Attachment
rightGlove.Parent = character
local leftGloveConstraint = Instance.new("RigidConstraint", leftHand)
leftGloveConstraint.Attachment0 = leftGripAttachment
leftGloveConstraint.Attachment1 = leftGlove.Attachment
leftGlove.Parent = character
end)
end)
1 Like