Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Part Not Damaging Specified Humanoids?

=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

3 comments

0

Maybe it has something to do with CFrame values

0

Your script oddly weird. I even re-made your script and did it normally how I would do these sort of things and it ended up giving me odd things. So, I did it without your kind of "style" or what you wanted to accomplish and it worked. So I am baffled, but if I have time later and this has not been answered I will try again. So, I mean then again it is late at night so I am not thinking all that I

0

alright

1 answer

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.