~=Problem=~
The parent to the script below is a beam that is constantly moving,for some reason it does not damage specified humanoids it touches, it does not print at all in either scripts
~=1st Script=~
script.Parent.Touched:connect(function(Part) print('Damage'..Part.Name) for i,v in pairs(Part.Parent:GetChildren()) do if string.lower(v.Name) == string.lower("Mob") and deb == false then deb = true print(Part.Parent) print(Part) Part.Parent.Mob:TakeDamage(script:WaitForChild('Damage').Value) script.Parent:Destroy() end end end)
~=Script Used Originally=~
deb = false script.Parent.Touched:connect(function(Part) print(Part.Name) if Part.Parent:FindFirstChild('Mob') then deb = true print(part.Parent) print(part) Part.Parent.Mob:TakeDamage(script:WaitForChild('Damage').Value) script.Parent:Destroy() end end)
~=Script That Moves Part=~
local direction = script.Object.Value.CFrame.lookVector while wait() do part.CFrame = part.CFrame + direction * 7 end
This should work;
string = # What string should equal. deb = false script.Parent.Touched:connect(function(Part) print('Damage'..Part.Name) for i,v in pairs(Part.Parent:GetChildren()) do if string.lower(v.Name) == string.lower("Mob") and deb == false then deb = true print(Part.Parent) print(Part) Part.Parent.Mob:TakeDamage(script:WaitForChild('Damage').Value) script.Parent:Destroy() end end end)
Sorry if this is wrong.