I have a script where the arm gets launched at a player using a animation. The problem is the touched events don't work unless the players turn. Is there any way to fix this?
totool = script.Parent
cooldown = false
character = game.Players.LocalPlayer.Character
player = game.Players.LocalPlayer
local function weldBetween(a, b)
--Make a new Weld and Parent it to a.
local weld = Instance.new("ManualWeld", a)
weld.Part0 = a
weld.Part1 = b
--Get the CFrame of b relative to a.
weld.C0 = a.CFrame:inverse() * b.CFrame
--Return the reference to the weld so that you can change it later.
return weld
end
tool.Activated:connect(function()
if cooldown == false then
rightArm = character["Right Arm"]:Clone()
rightArm.Name = "CRight Arm"
rightArm.Parent = character
x = game.Lighting.AnimationFixScript2:Clone()
x.Parent = rightArm
weldBetween(rightArm,character["Right Arm"])
cooldown = true
game.Chat:Chat(player.Character.Head, "Chop Chop Punch!")
Animation = tool.Animation
AnimationTrak = tool.Parent.Humanoid:LoadAnimation(Animation)
AnimationTrak:Play()
candamage = true
rightArm.touched:connect(function(Target)
if candamage == true then
if Target.Parent.Name ~= character.Name and candamage == true then
candamage = false
Target.Parent.Humanoid.Health = Target.Parent.Humanoid.Health - 20
candamage = false
wait(2)
end
end
end)
wait(5)
cooldown = false
end
end)

3 comments
Could you explain the problem more?
Use a .touched event?
No like touched events don't work if you play a animation. The only way I know is to make the play turn while the animation is playing and they are touching a object. But what I'm asking is there any other way?