Recently, I was working on making a tool go to the player’s left arm, but of course there is a problem, an annoying one.
So, when a player equips the tool, I want the handle to go as instantly as possible to the left arm, but no.
Instead, the tool would kind of glitch out or something… and then go onto the player’s left arm.
(I apologize for the buggy video)
Like I said, I want the tool to go instantly to the left arm, I don’t want it to glitch out or anything while instantly going to the left arm.
Here is the code for the grip:
local tool = script.Parent
local grip = script:WaitForChild("fixGrip")
local setnil = script:WaitForChild("setNil")
local newgrip
local cframeValue = CFrame.new(-0.2,-0.5,0)
local orientationValue = CFrame.fromEulerAnglesXYZ(math.rad(-90),0,math.rad(90))
grip.OnServerEvent:Connect(function(plr)
local chr = plr.Character or plr.CharacterAdded:Wait()
local leftarm = chr:WaitForChild("Left Arm")
if not leftarm:FindFirstChildWhichIsA("Motor6D") then
newgrip = Instance.new("Weld", leftarm)
newgrip.Part0 = leftarm
newgrip.Part1 = tool:WaitForChild("hand")
newgrip.C0 *= cframeValue * orientationValue
newgrip.Name = "LeftGrip"
else
return
end
end)
I don’t really think that there is even a fix for this, but any help is appreciated.
Oh, maybe try using RenderStepped to prevent the user from seeing it bug out? I’m not sure how else to do it because I’m assuming Roblox forces a RightGrip.
I honestly wish roblox made some type of system where you can switch the hands of where the tool is being equipped from, instead of just making it harder for us to handle tools.
You would need to connect it to the left arm on the client first to make it look seamless.
You can do so like this: (LocalScript in StarterCharacterScripts)
script.Parent.DescendantAdded:Connect(function(child)
if child.Name == "RightGrip" then -- check if its the tool handle weld
task.defer(function() -- this is necessary
child:Destroy() -- remove original weld
local leftarm = script.Parent:WaitForChild("Left Arm")
if not leftarm:FindFirstChildWhichIsA("Motor6D") then -- rest of your tool connecting logic
newgrip = Instance.new("Weld")
newgrip.Part0 = leftarm
newgrip.Part1 = tool:WaitForChild("hand")
newgrip.C0 *= cframeValue * orientationValue
newgrip.Name = "LeftGrip"
newgrip.Parent = leftarm
end
end)
end
end)
Thank you for posting this man, but I just found a solution.
My solution is that, when the player equips the tool, I will clone the item that is supposed to be in the tool, put the cloned item into the tool, then weld the tool and the left arm together.
I just came up with this solution out of nowhere, and it is now working perfectly and is working as I want it to.
I suppose this can also work with multiple tools as well.