script.Parent.Touched:connect(function() Instance.new("Explosion", game.Workspace.BlowPart) local Explosion = game.Workspace.BlowPart.Explosion game.Workspace.BlowPart:FindFirstChild("Humanoid") Explosion.Position = script.Parent.Position end)
I put an explosion instance in a Part named "BlowPart", I gave the explosion a Position too. So.. why when I touch the "BlowPart" it explodes.. BUT the workspace also explodes at (0, 0, 0)? I gave a CLEAR position. But it's exploding in two places at once. How do I fix this stupid glitch? Is it my computer? My studio?
Not to mention, the first time I touch the brick, it explodes I die, any other time after that, I don't die because for some reason, it's acting as if I'm giving the explosion two positions to transition from.
Output says:
12:08:20.179 - script.Parent.Touched:connect(function() Instance.new("Explosion", game.Workspace.BlowPart) local Explosion = game.Workspace.BlowPart.Explosion game.Workspace.BlowPart:FindFirstChild("Humanoid") Explosion.Position = script.Parent.Position end):1: attempt to index global 'script' (a nil value)
Explosions explode as soon as they are in workspace. You're putting it in workspace on line 3. That's where it explodes. Lines 4 and 5 do nothing; it already exploded. Don't set the parent of the explosion until last.
script.Parent.Touched:connect(function() local Explosion = Instance.new("Explosion") Explosion.Position = script.Parent.Position Explosion.Parent = game.Workspace.BlowPart end)
--this is just so you understand what waffle was saying...
The above answers are probably correct, but Explosion.Position
does not actually exist. Use Explosion.position
instead.