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

Script ignores or does not recognize specific part, How to fix?

Asked by 6 years ago
    elseif (hit.Parent.Parent.Hull.Name == "FrontArmor") then -- hitparts
        print("voce danificou o chassi")
        local HitSound = hit.Parent:findFirstChild("Pen"):Clone()
        HitSound.Parent = hit
        HitSound:Play()
        hit.Parent.Parent:findFirstChild("Damage").Value = hit.Parent.Parent:findFirstChild("Damage").Value - dealingdamage /2 -- makes the damage

Basically this script detects hit on some object and the damage, I set up this line to detect hit in a specific part or it should ... because in test mode this line is ignored, there is nothing in the output related to errors or something like that.

0
the part i want to hit is Called "FrontArmor notasfeia 1 — 6y
0
you’re using deprecated methods. switch to FindFirstChild. i’ll rewrite the script. don’t use elseif like that. i’ll show that User#19524 175 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

Script Inside the damaging part itself:

script.Parent.Touched:Connect(function(hit)
    local doesPlrHaveArmor = hit.Parent:FindFirstChild(“FrontArmor”)
    if hit.Parent:FindFirstChildOfClass(“Humanoid”) and not doesPlrHaveArmor then
        hit.Parent.Humanoid.Health = hit.Parent.Humanoid.Health -  your damage
    elseif doesPlrHaveArmor then
        hit.Parent.Humanoid.Health = hit.Parent.Humanoid.Health - your damage / 2
    end
end)
0
this script that I did was to simulate armor in a vehicle, that one that you wrote works for a humanoid, I'll try to modify this one you wrote notasfeia 1 — 6y
0
it says "touched is not a valid part of the model" notasfeia 1 — 6y
0
I Will send the whole script on the answers notasfeia 1 — 6y
Ad

Answer this question