for some reason, this script connects, destroys itself at the end, but doesn't actually insert the Explosion like it should. It works fine when r is false by the way.
-- cre is an object value -- r is a Boolean value function onHit(hit) if hit.Parent:FindFirstChild("Humanoid") and r.Value == false and hit.Parent.Name ~= cre.Value.Name then hit.Parent.Humanoid:TakeDamage(10) elseif r.Value == true and hit.Parent.Name ~= cre.Value.Name then local bo = Instance.new("Explosion") bo.BlastPressure = 10000 bo.BlastRadius = 20 bo.Parent = script.Parent end wait() script.Parent:Destroy() end
You need to set the position of the explosion, otherwise it'll go off at 0, 0, 0
-- cre is an object value -- r is a Boolean value function onHit(hit) if hit.Parent:FindFirstChild("Humanoid") and r.Value == false and hit.Parent.Name ~= cre.Value.Name then hit.Parent.Humanoid:TakeDamage(10) elseif r.Value == true and hit.Parent.Name ~= cre.Value.Name then local bo = Instance.new("Explosion") bo.BlastPressure = 10000 bo.BlastRadius = 20 bo.Parent = script.Parent bo.Position=script.Parent.Position end wait() script.Parent:Destroy() end