Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Part Not Damaging Specified Humanoids?

Asked by 7 years ago
Edited 7 years ago

~=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
0
Maybe it has something to do with CFrame values RGRage 45 — 7y
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 yougottols1 420 — 7y
0
alright Faker243 43 — 7y

1 answer

Log in to vote
0
Answered by 7 years ago
Edited 7 years ago

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.

Ad

Answer this question