I've made an explosion using a sphere and TweenService. I've also made a script which has to kill the player using a character explosion, but the game starts to lag during the explosion until it crashes. I've added some delays and a debounce value, but the script continues to cause heavy lag.
Here's the "PlayerKiller" script:
local done = false
function ontouch(hit)
if not done then
done = true
if hit.Parent and game.Players:GetPlayerFromCharacter(hit.Parent) then
local exp = Instance.new('Explosion')
exp.Position = hit.Position
exp.Parent = workspace
end
else
wait(2)
done = false
end
wait(1)
end
wait(1)
script.Parent.Touched:Connect(ontouch)

1 comment
Look at Roblox's tutorial on how to make a cannon and the cannon ball basically tells hoot make the explosion when touched