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

How do I fix this positioning?

Asked by 10 years ago

Without the .touched it works fine but when I added it the second part is not aligned in the center correctly

p2 = Instance.new("Part" , game.Workspace)
    game.Debris:AddItem(p2,3)   
    p2.TopSurface = "Smooth"
    p2.BottomSurface = "Smooth"
    p2.BrickColor = BrickColor.new("Bright red")
    local m = Instance.new("CylinderMesh" ,p2)
    m.Scale = Vector3.new(1,1,2)
    p2.Anchored = true
    p2.CanCollide = false
    p2.Transparency = 0.3
    p2.Size = Vector3.new(1.8,90,2)
    p2.CFrame = p.CFrame * CFrame.new(0,0,-45.1)
    p2.CFrame = p2.CFrame * CFrame.Angles(4.7,0,0)
    p2.Touched:connect(function(Part)
        if Part.Parent:FindFirstChild("Humanoid") then
            Part.Parent.Humanoid.Health = 0
        end
    end)
    num = 0

    for i = 1,30  do    
        num = 0.03  
        m.Scale = m.Scale - Vector3.new(num,0,0)
        p2.Size = p2.Size - Vector3.new(num,0,0)
        wait(0.1)   
    end

p Has already been created and the code I am showing is inside an activated function

1 answer

Log in to vote
0
Answered by 10 years ago

I fixed it myself sorry!

Ad

Answer this question