Im having issues with a tool attaching to the torso of the player, it does as expected but the problem is that the hand is still attached to the handle (and this means the hand detaches from the player, this is my main concern), im super confused at how this works since a friend of mine helped with the script, im no professional so I have no idea how to continue or what to do.
I’ve searched everywhere and looked at various posts here, but none really helped as my scripting skills arent that high to understand most of them
All I just need is the tool to attach to the torso of the player and thats it, without having the hand attached to it too, how could I fix this?
-- Check if the parent is a Tool
if script.Parent:IsA("Tool") then
-- Connect the Equipped event
script.Parent.Equipped:Connect(function()
-- Get the character from the tool
local character = script.Parent.Parent
-- Check if character exists
if character and character:IsA("Model") then
-- Create a Motor6D instance
local motor = Instance.new("Motor6D")
motor.Name = "ToolMotor" -- Name it whatever you want
motor.Parent = character.UpperTorso
motor.Part0 = character.UpperTorso
motor.Part1 = script.Parent.Handle
-- Set the desired position and rotation (adjust as needed)
local offset = Vector3.new(0, 0, 0) -- Adjust position offset
local rotationOffset = CFrame.Angles(0, math.rad(90), 0) -- Adjust rotation offset
motor.C0 = CFrame.new(offset) * rotationOffset
end
end)
-- Connect the Unequipped event
script.Parent.Unequipped:Connect(function()
-- Get the character from the tool
local character = script.Parent.Parent
-- Check if character exists
if character and character:IsA("Model") then
-- Find and destroy the Motor6D instance
local motor = character.UpperTorso:FindFirstChild("ToolMotor")
if motor then
motor:Destroy()
end
end
end)
else
print("Script must be placed directly within the Tool object.")
end
I’m pretty sure there’s a Motor6D called “Right Grip” in “Right Hand” (for R15) or “Right Arm” for (R6) which is automatically created to attach the tool to the hand. You should delete it right after equipping the tool.
And how would I do that exactly? Im sorry im pretty new to stuff like this and I find these things truly complex, is it something I can just do or does it require me to add it to the script?
-- Place this at the beginning of your .Equipped function.
local RightArm = Character:FindFirstChild("Right Arm")
RightArm:FindFirstChild("Right Grip"):Destroy()
By the way, you should probably do all your code in a separate server script (especially when instancing Motor6Ds and assigning Property, otherwise if you do it on the client (localscript) only YOU can see it. See Remote Events.
Sadly its not working, hand is still missing (its inside the torso since the handle is positioned there)
Did I write it correctly? Again, I apologize as I have no idea what im doing and its like 7am, my brain isnt with all its lights on !!
-- Check if the parent is a Tool
if script.Parent:IsA("Tool") then
-- Connect the Equipped event
script.Parent.Equipped:Connect(function()
-- Get the character from the tool
local character = script.Parent.Parent
-- Check if character exists
if character and character:IsA("Model") then
-- Create a Motor6D instance
local motor = Instance.new("Motor6D")
motor.Name = "ToolMotor" -- Name it whatever you want
motor.Parent = character.UpperTorso
motor.Part0 = character.UpperTorso
motor.Part1 = script.Parent.Handle
-- Set the desired position and rotation (adjust as needed)
local offset = Vector3.new(0, 0, 0) -- Adjust position offset
local rotationOffset = CFrame.Angles(0, math.rad(90), 0) -- Adjust rotation offset
motor.C0 = CFrame.new(offset) * rotationOffset
local RightArm = character:FindFirstChild("Right Arm")
if RightArm then
local RightGrip = RightArm:FindFirstChild("Right Grip")
if RightGrip then
RightGrip:Destroy()
end
end
end
end)
-- Connect the Unequipped event
script.Parent.Unequipped:Connect(function()
-- Get the character from the tool
local character = script.Parent.Parent
-- Check if character exists
if character and character:IsA("Model") then
-- Find and destroy the Motor6D instance
local motor = character.UpperTorso:FindFirstChild("ToolMotor")
if motor then
motor:Destroy()
end
end
end)
else
print("Script must be placed directly within the Tool object.")
end
Sending the code again in case there is something that im missing
-- Check if the parent is a Tool
if script.Parent:IsA("Tool") then
-- Connect the Equipped event
script.Parent.Equipped:Connect(function()
-- Get the character from the tool
local Character = script.Parent.Parent
-- Check if character exists
if Character and Character:IsA("Model") then
-- Create a Motor6D instance
local motor = Instance.new("Motor6D")
motor.Name = "ToolMotor" -- Name it whatever you want
motor.Parent = Character.UpperTorso
motor.Part0 = Character.UpperTorso
motor.Part1 = script.Parent.Handle
-- Set the desired position and rotation (adjust as needed)
local offset = Vector3.new(0, 0, 0) -- Adjust position offset
local rotationOffset = CFrame.Angles(0, math.rad(90), 0) -- Adjust rotation offset
motor.C0 = CFrame.new(offset) * rotationOffset
local RightHand = Character:FindFirstChild("RightHand")
if RightHand then
local RightGrip = RightHand:FindFirstChild("RightGrip")
if RightGrip then
RightGrip:Destroy()
end
end
end
end)
-- Connect the Unequipped event
script.Parent.Unequipped:Connect(function()
-- Get the character from the tool
local Character = script.Parent.Parent
-- Check if character exists
if Character and Character:IsA("Model") then
-- Find and destroy the Motor6D instance
local motor = Character.UpperTorso:FindFirstChild("ToolMotor")
if motor then
motor:Destroy()
end
end
end)
else
print("Script must be placed directly within the Tool object.")
end
try placing the thread to the beginning of your .Equipped function. could be something that’s preventing it from deleting either from one of your line of code or due to sanity checks
did “ToolMotor” get created? if not i think you should do it on the server and not on the client
i am also confused haha, with the rest of your code the tool should have been positioned to torso without involving the hand
I might just get back to this in the morning, way too late right now and I think thats also affecting this whole process lol
in case you would like to take a look at it and maybe you find something else, here is the model (you obviously dont have to, but just in case you’d like to)
But thank you for trying and help still, will get back to this tomorrow
just tested out your model, seems perfectly fine. only needs a bit more offsetting to properly place the entire model beneath the player’s foots. only the arm of the player needs fixing, which can be done via. this user’s solution: How to delete the "Hand up" animation that plays when equipping a tool?
also, you should use humanoidrootpart to weld the “ritual” part instead of uppertorso, since it can result in the item getting turned over when the player is.