This is unneeded, you are constantly resetting the Weld.
while true do
repeat wait() until components.righthand
if tool.Parent == chara then
if components.waistOn.Value == true then
chara.RightHand.RightGrip.Part0 = chara.LowerTorso
chara.RightHand.RightGrip.C0 = CFrame.new(math.rad(65), math.rad(-30), math.rad(15)) * CFrame.Angles(math.rad(135), 0, 0)
else
chara.RightHand.RightGrip.Part0 = chara.RightHand
chara.RightHand.RightGrip.C0 = CFrame.new(0, 0, 0) * CFrame.Angles(math.rad(-90), math.rad(-90), 0)
end
end
wait()
end
A better version would work as so:
local tool = script.Parent.Parent
local plr = game.Players.LocalPlayer
local chara = plr.Character
local rightGrip = chara:WaitForChild("RightHand"):WaitForChild("RightGrip") --the weld
local waistOn = false
--Is this used anywhere else? If not use a variable such as shown with waistOn
local waistOnBoolValue = tool.Handle.Values.WaistOn --the bool value toggle (Couldn't this be stored as a variable as shown?)
local function Equiped()
waistOn = false --Default to false
--Not sure if something else uses this so we keep this here
waistOnBoolValue.Value = false
end
local function Activate()
waistOn = not waistOn --Toggle
--Notice how I am doing this in the activate function?
--This is ran when the tool is activated instead of every 1/30th a second as with wait().
if waistOn then
chara.RightHand.RightGrip.Part0 = chara.LowerTorso
chara.RightHand.RightGrip.C0 = CFrame.new(1.13, -0.52, 0.26) * CFrame.Angles(math.rad(135), 0, 0)
else
chara.RightHand.RightGrip.Part0 = chara.RightHand
chara.RightHand.RightGrip.C0 = CFrame.new(0, 0, 0) * CFrame.Angles(math.rad(-90), math.rad(-90), 0)
end
--By the way, doing CFrame.new(x, y, z) is actually creating a CFrame at location X, Y, Z
--
--So you can't apply a rotation here in your case of (math.rad(65), math.rad(-30), math.rad(15))
--It is actually creating a new CFrame at position (1.13, -0.52, 0.26) relative to the weld's Part0
--But, multiplying this cframe by CFrame.Angles(math.rad(135), 0, 0) will apply a rotation.
--CFrame.Angles() is actually creating a blank CFrame with the rotation as provided, then
--When you multiply this with your "position" CFrame (1.13, -0.52, 0.26), you are in a sense
--then applying the rotation to the CFrame at point (1.13, -0.52, 0.26)
--Not sure if something else uses this so we keep this here
waistOnBoolValue.Value = not components.waistOn.Value
end
tool.Activated:Connect(Activate)
tool.Equipped:Connect(Equiped)
--Did you know you can also do this? This is known as an anonymous function.
tool.Equipped:Connect(function()
isEquipped = false
end)
For more help with CFrames, please refer to Understanding CFrames