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

Why won't these parts spawn?

Asked by 10 years ago

Hello! I have recently made my own morph for a Big Daddy from Bioshock, I am now developing a drill to go along with it, that is supposed to damage humanoids and spawn blood. It damages the Humanoid but does not spawn the Blood. It is in a tool and I can hold it, I also have several parts named "Part", one Part named "Drill", one named "Tip" which is were the blood comes out, and one part named "Handle" which is were the script is located. Here is what I have so far: Note nothing comes up in the Output.

function onTouched(hit)
    local humanoid = hit.Parent:findFirstChild("Humanoid")
    if (humanoid ~= nil) then
        humanoid.Health = humanoid.Health - 30
    end
        P1 = Instance.new("Part")
P1.Position = script.Parent.Parent.Tip.Position
P1.TopSurface = "Smooth"
P1.BottomSurface = "Smooth"
P1.BrickColor = BrickColor.new("Bright red")
P1.FormFactor = 2
P1.Size = Vector3.new(1,0.4,1)
P1.CanCollide = true
P1.Anchored = false
P1.Transparency = 0

        P2 = Instance.new("Part")
P2.Position = script.Parent.Parent.Tip.Position
P2.TopSurface = "Smooth"
P2.BottomSurface = "Smooth"
P2.BrickColor = BrickColor.new("Bright red")
P2.FormFactor = 2
P2.Size = Vector3.new(1,0.4,1)
P2.CanCollide = true
P2.Anchored = false
P2.Transparency = 0
end
connection = script.Parent.Touched:connect(onTouched)

1 answer

Log in to vote
1
Answered by
Mr1Vgy 30
10 years ago

Did you set the Part's Parent?

P1.Parent = parentThing --change this to whatever you want the parent to be
0
Thanks! that worked! minikitkat 687 — 10y
0
Or when using instance.new('Part', parent) parent becomes the new part's parent. GoldenPhysics 474 — 10y
Ad

Answer this question