Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

This isn't working! Help?

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

1 comment

0

Please specify how this isn't working, we don't know what you want this to do and what it's doing instead.

1 answer

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 comment

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

This discussion is preserved as it was. New answers, comments, and votes are closed.