if meleebool == true then if RArm.Touched:Connect(function(hit) then if hit.Parent.Humanoid then hit.Parent.Humanoid.Health = hit.Parent.Humanoid.Health -12 end end) if LArm.Touched:Connect(function(hit) then if hit.Parent.Humanoid then hit.Parent.Humanoid.Health = hit.Parent.Humanoid.Health -12 end end) if weaponinhand.Touched:Connect(function(hit) then if hit.Parent.Humanoid then hit.Parent.Humanoid.Health = hit.Parent.Humanoid.Health -12 end end) end
error: Expected identifier when parsing expression, got 'then'
local events are NEVER can be in if.. then. try just removing if's and then's.
if meleebool == true then RArm.Touched:Connect(function(hit) if hit.Parent.Humanoid then hit.Parent.Humanoid.Health = hit.Parent.Humanoid.Health -12 end end) LArm.Touched:Connect(function(hit) if hit.Parent.Humanoid then hit.Parent.Humanoid.Health = hit.Parent.Humanoid.Health -12 end end) weaponinhand.Touched:Connect(function(hit) if hit.Parent.Humanoid then hit.Parent.Humanoid.Health = hit.Parent.Humanoid.Health -12 end end) end
I hope i was able to help! good day!
Basically with Events, You don't need to use an IF Statement.
if meleebool == true then RArm.Touched:Connect(function(hit) hit.Parent.Humanoid then hit.Parent.Humanoid.Health = hit.Parent.Humanoid.Health -12 end end) LArm.Touched:Connect(function(hit) then hit.Parent.Humanoid hit.Parent.Humanoid.Health = hit.Parent.Humanoid.Health -12 end end) weaponinhand.Touched:Connect(function(hit) hit.Parent.Humanoid hit.Parent.Humanoid.Health = hit.Parent.Humanoid.Health -12 end end) end
The Event is going to fire when the RArm is going to be touched, so there is no need to check if it got touched or not