I made a script, it shoots a part, the part welds to what ever it hits, wait 5 seconds, and then explodes. Unfortunately, it isn't blowing up! Why not? Here is my script
function onTouched(hit) local weld = Instance.new ("Weld") weld.Parent = hit weld.Part0 = script.Parent weld.Part1 = hit wait(5) --not my part ex = Instance.new("Explosion")--Create An Explosion ex.Position = script.Parent.Position --The Explosions Position Is The Brick ex.BlastRadius = 2 --A 5 by 5 Explosion. ex.Parent = script.Parent --You got to be able to see it. --my part again hit:BreakJoints() script.Parent:Remove() end connection = script.Parent.Touched:connect(onTouched)
Please help!!! Thank you!!! --this is in a regular script, should it be in local?
Here is the right script. It works and you can see the explosion
function onTouched(hit) local weld = Instance.new ("Weld") weld.Parent = hit weld.Part0 = script.Parent weld.Part1 = hit wait(5) local explo = Instance.new("Explosion") explo.Parent = game.Workspace explo.BlastRadius = 2 explo.Position = Vector3.new(script.Parent.Position.X,script.Parent.Position.Y,script.Parent.Position.Z) hit:BreakJoints() wait(1) script.Parent:Remove() end connection = script.Parent.Touched:connect(onTouched)
Locked by TheMyrco
This question has been locked to preserve its current state and prevent spam and unwanted comments and answers.
Why was this question closed?