Why do these scripts not work as intended?

I’m trying to make these 2 scripts work for my game Spades of War and theres 2 problems.

  1. The left arm’s Z rotation is a little messed up after unequipping the tool
  2. The “Model.Metal” is below where I want it to be.

I tried changing the scripts alot and (sadly) had to use AI to try and figure out the issue but even it couldn’t fix it or it just messed it up. All I need to know is how to fix it and that’s that.
if it helps my character is a custom rig not an r15 or r6.

the local script

local Tool = script.Parent
local Track1 = Tool.Idle
local Idle = nil

Tool.Equipped:Connect(function(Mouse)
	local Character = Tool.Parent
	local Humanoid = Character:WaitForChild("Humanoid")
	local Animator = Humanoid:WaitForChild("Animator")

	Idle = Animator:LoadAnimation(Track1)
	Idle:Play()
end)

Tool.Unequipped:Connect(function(Mouse)
	if Idle then
		Idle:Stop()
		Idle = nil
	end
end)

the server script

local Tool = script.Parent
local Weld = Tool:WaitForChild("Metal") --this is a motor6D btw, its how it was in the animation
local Metal = Tool.Model:WaitForChild("Metal") -- this is the actual Metal thing

Tool.Equipped:Connect(function()
	local Character = Tool.Parent
	local Pelvis = Character:WaitForChild("Pelvis") --my character isnt R15 nor R6 so that might be the problem but i believe its the script

	Weld.Part0 = Pelvis
	Weld.Part1 = Metal
	Weld.Parent = Pelvis
end)

Tool.Unequipped:Connect(function()
	Weld.Parent = Tool
end)
1 Like

Try Weld.C0 *= CFrame.new(0, 1, 0) and tweak the Y axis but that might mess up the animation still try tho

that helped somehow, thanks but the left arm issue is still there.

1 Like

i tried to fix the left arm issue myself and did, but the instant i tried it again after fixing it… it just completely broke for some lovely amazing reason even if all I CHANGED WAS ONE LINE OF CODE. NOW EVEN IF I GO BACK IT JUST HAS THE ANIMATIONS BE BROKEN EVEN IF I DIDNT CHANGE IT.

1 Like

changed 1 line again and it works now. roblox studio is a weird tool man

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.