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)
Is this supposed to explode
Ok, I solved the problem using a local script for each player and not a single script in the exploding part. Thanks anyway.