-- Function to make a player explode

local function explodePlayer(player)
	if player.Character then
		local humanoid = player.Character:FindFirstChild("Humanoid")

		if humanoid then
			-- Listen for the jump event
			local connection
			connection = humanoid:GetPropertyChangedSignal("Jump"):Connect(function()
				if humanoid:GetState() == Enum.HumanoidStateType.Seated then
					return
				end

				-- Remove the connection to prevent multiple explosions
				connection:Disconnect()

				-- Create an explosion at the player's position
				local explosion = Instance.new("Explosion")
				explosion.Position = humanoid.Parent.HumanoidRootPart.Position
				explosion.Parent = game.Workspace

				-- Respawn the player (optional)
				wait(5) -- You can adjust the respawn delay as needed
				game:GetService("StarterPlayer"):RemovePlayer(player)
			end)
		end
	end
end
