Tool grip not changing when swung

Hello developers,

My goal is to change the weapons grip when the sword is swung. To create a better swing effect.

My problem is that for some reason, it doesn’t change. No errors pop up, and it doesn’t break anywhere. In which I assume that the script is reasonable, it just won’t run.

Here is my code (yes very janky I know. I will fix that later.) :

local tool = script.Parent

local debounce = false

local SwingDetector = tool:WaitForChild("Swing")

	if SwingDetector.Value == true and debounce == false then
		debounce = true
		tool.GripForward =, 0, 0.866)
		tool.GripPos =, 0.1, -1.7)
		tool.GripRight =, 1, -0)
		tool.GripUp =, -0, 0.5)
		tool.GripForward =, 0, -0)
		tool.GripPos =, 0.1, -1.7)
		tool.GripRight =, 1, -0)
		tool.GripUp =, 0, 1)
		debounce = false
		SwingDetector.Value = false

Anything helps.

Have you tried putting prints in to confirm the logic flows as you expect?

1 Like

I thought of it, but I didn’t. I will do that rn.

Update: It works the 1st time, not any other time though.

As this is an animation , sort of, I would set a wait between each tool.Grip… statement to slow the whole process down ( to help with the visual aspects) and make sure I have a print of the before and after values.

You set the value of SwingDetector to false when the animation is finished and don’t change it back, and because the animation only plays when SwingDetector is true, it won’t activate again after the first use.

1 Like