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

This isn't working! Help?

Asked by
Resnex 60
10 years ago

I'm trying to make this shield that defends against bullets and paintballs, but it isn't working!

function onTouched(part)
    if part.Name == "Bullet" or "Paintball" then
        Shield = Instance.New("Part")
        Shield.Size = Vector3.new(.2,.2,.2)
        Shield.CanCollide = false
        Shield.Parent = game.Workspace
        Shield.BrickColor = ("Really red")
        Shield.Position = script.Parent

        local mesher = Instance.new("BlockMesh")
        mesher.Parent = Shield
        mesher.Scale = Vector3.new(0.2, 0.2, (script.Parent.Position - onTouched(part).Position).magnitude)

        explosion = Instance.new("Explosion")
        explosion.Parent = game.Workspace
        explosion.Position = part

        wait(1)
        part:remove()
    end
end
0
Please specify how this isn't working, we don't know what you want this to do and what it's doing instead. adark 5487 — 10y

1 answer

Log in to vote
-3
Answered by 10 years ago

Isn't the method at the end of your script wrong? part:remove() isn't a method.

part:Remove()

is a method, other than that I don't know how to help.

1
Line 12, it seems like you're calling the OnTouched again, within a Vector3? You already have the 'part' defined. Just say part.Position, not onTouched(part).Position hiccup111 231 — 10y
Ad

Answer this question