So, I'm trying to make an axe. Simple enough, right? Well, to my beginner self, apparently not.

The way i'm trying to do is is like such:

Has the blade been hit? If so.. Has the blade been swung? if so.. play sound, damage tree, etc...

It works all fine and dandy, except for the "has the blade been swung" part.

I've boiled it down to the very basics, just for debugging purposes, yet it STILL doesn't work.

local blade = script.Parent.Blade


blade.Touched:connect(function(hit)
	local swinging = script.Parent.swinging
	print(swinging.Value)
end)

Here's also the animation localscript, if it helps.

wait(0.5)

local player = game.Players.LocalPlayer
local tool = script.Parent
local char = player.Character
local swing = script.Swing
local canAttack = true

script.Parent.Activated:connect(function()

	local swingValue = script.Parent.swinging	
	local attac = char.Humanoid:LoadAnimation(swing)
	
	if canAttack == true then
		
		swingValue.Value = true
		attac:Play()
		canAttack = false
		
		print(swingValue.Value)
		
		wait(1.2)
		
		swingValue.Value = false
		attac:Stop()
		canAttack = true
		
		print(swingValue.Value)

	end
end)

I've made sure that the problem isn't the Bool Value itself, and I can confirm it isn't. The anim localscript changes it with no problems.

2 comments

0

I just tried this out in Studio in a much more basic situation and it worked fine for me In your local script, don't change the value back to false; just to see if the Touched still doesn't print true. I'm not for sure; your code looks fine to me.

0

I tried that now, and it still didn't work. Would you mind posting your code so I could compare?