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 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 = Touched(part) wait(.5) part:remove() print("WORKING!!") end end script.Parent.Touched:connect(Part)
I looked at output in Testing, and it said that: " Attempt to connect failed: Passed value is not a function"
Anyone know what I'm doing wrong?
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 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 = Touched(part) wait(.5) part:remove() print("WORKING!!") end end script.Parent.Touched:connect(onTouched) -- Just edited this again.
Now try it. I was looking through the wiki and I didn't see anything for that.. I was looking here: http://wiki.roblox.com/index.php/Basic_Scripting
Your line 23 is supposed to be stated like this:
script.Parent.Touched:connect(onTouch)
function onTouched(part) if part.Name == "Bullet" or part.Name == "Paintball" then -- Add part.Name == Shield = Instance.New("Part", Workspace) -- Add Parent here Shield.Size = Vector3.new(.2,.2,.2) Shield.CanCollide = false Shield.BrickColor = BrickColor.new("Really red") --BrickColor.new Shield.CFrame = script.Parent.CFrame -- No Position Its CFrame mesher = Instance.new("BlockMesh", Shield) -- Parent here mesher.Scale = Vector3.new(0.2, 0.2, (script.Parent.Position - onTouched(part).Position).magnitude) explosion = Instance.new("Explosion", Workspace) -- Parent here explosion.CFrame = part.CFrame --Position = CFrame wait(.5) part:remove() print("WORKING!!") end end script.Parent.Touched:connect(part) -- No Maj on the p