Sans titre

 local Players = game:GetService("Players")


-- 1. CRÉATION AUTOMATIQUE DE L'INTERFACE (Jauge de sang)

Players.PlayerAdded:Connect(function(player)

    local playerGui = player:WaitForChild("PlayerGui")

    

    -- Empêcher les doublons si le joueur respawn

    if playerGui:FindFirstChild("SurvivalGui") then

        playerGui.SurvivalGui:Destroy()

    end

    

    local screenGui = Instance.new("ScreenGui")

    screenGui.Name = "SurvivalGui"

    screenGui.Parent = playerGui

    

    -- Fond de la jauge

    local bgBar = Instance.new("Frame")

    bgBar.Size = UDim2.new(0, 220, 0, 30)

    bgBar.Position = UDim2.new(0.5, -110, 0, 15)

    bgBar.BackgroundColor3 = Color3.fromRGB(40, 40, 40)

    bgBar.BorderSizePixel = 0

    bgBar.Parent = screenGui

    

    -- Remplissage de la jauge (Couleur Sang)

    local healthBar = Instance.new("Frame")

    healthBar.Name = "HealthBar"

    healthBar.Size = UDim2.new(1, 0, 1, 0)

    healthBar.BackgroundColor3 = Color3.fromRGB(180, 0, 0)

    healthBar.BorderSizePixel = 0

    healthBar.Parent = bgBar

    

    -- Texte de la jauge

    local textLabel = Instance.new("TextLabel")

    textLabel.Size = UDim2.new(1, 0, 1, 0)

    textLabel.BackgroundTransparency = 1

    textLabel.Text = "❤️ JAUGE DE SANG"

    textLabel.TextColor3 = Color3.fromRGB(255, 255, 255)

    textLabel.TextScaled = true

    textLabel.Font = Enum.Font.SourceSansBold

    textLabel.Parent = bgBar

    

    -- Mettre à jour la jauge en fonction de la vie du personnage

    player.CharacterAdded:Connect(function(character)

        local humanoid = character:WaitForChild("Humanoid")

        humanoid.HealthChanged:Connect(function(health)

            local maxHealth = humanoid.MaxHealth

            local pourcentage = math.clamp(health / maxHealth, 0, 1)

            healthBar.Size = UDim2.new(pourcentage, 0, 1, 0)

        end)

    end)

end)


-- 2. LA BOUCLE DE CHAOS ET DES ÉVÉNEMENTS

while true do

    task.wait(9)

    

    -- Choisir un événement parmi 6 choix (maintenant avec les atouts !)

    local choix = math.random(1, 6)

    

    if choix == 1 then

        -- 1. CHANGEMENT DE GRAVITÉ

        local g = math.random(1, 2) == 1 and 20 or 400

        workspace.Gravity = g

        print("Événement : Gravité modifiée !")

        

    elseif choix == 2 then

        -- 2. PLUIE DE BOMBES CIBLÉES

        print("Événement : Bombes ciblées !")

        for _, player in ipairs(Players:GetPlayers()) do

            if player.Character and player.Character:FindFirstChild("HumanoidRootPart") then

                local pos = player.Character.HumanoidRootPart.Position

                

                local alerte = Instance.new("Part")

                alerte.Size = Vector3.new(6, 0.2, 6)

                alerte.Shape = Enum.PartType.Cylinder

                alerte.Anchored = true

                alerte.CanCollide = false

                alerte.Material = Enum.Material.Neon

                alerte.BrickColor = BrickColor.new("Bright red")

                alerte.CFrame = CFrame.new(pos.X, 0.5, pos.Z) * CFrame.Angles(0, 0, math.pi/2)

                alerte.Parent = workspace

                

                task.delay(1, function()

                    if alerte and alerte.Parent then alerte:Destroy() end

                    local bombe = Instance.new("Part")

                    bombe.Size = Vector3.new(4, 4, 4)

                    bombe.Shape = Enum.PartType.Ball

                    bombe.Material = Enum.Material.Neon

                    bombe.BrickColor = BrickColor.new("Really black")

                    bombe.Position = Vector3.new(pos.X, 35, pos.Z)

                    bombe.Parent = workspace

                    

                    task.delay(0.8, function()

                        if bombe and bombe.Parent then

                            local exp = Instance.new("Explosion")

                            exp.Position = bombe.Position

                            exp.BlastRadius = 12

                            exp.Parent = workspace

                            bombe:Destroy()

                        end

                    end)

                end)

            end

        end

        

    elseif choix == 3 then

        -- 3. TEMPÊTE D'ÉCLAIRS

        print("Événement : Éclairs foudroyants !")

        for _, player in ipairs(Players:GetPlayers()) do

            if player.Character and player.Character:FindFirstChild("HumanoidRootPart") then

                local pos = player.Character.HumanoidRootPart.Position

                

                local flash = Instance.new("Part")

                flash.Size = Vector3.new(5, 0.2, 5)

                flash.Shape = Enum.PartType.Cylinder

                flash.Anchored = true

                flash.CanCollide = false

                flash.Material = Enum.Material.Neon

                flash.BrickColor = BrickColor.new("New Yeller")

                flash.CFrame = CFrame.new(pos.X, 0.5, pos.Z) * CFrame.Angles(0, 0, math.pi/2)

                flash.Parent = workspace

                

                task.delay(0.7, function()

                    if flash and flash.Parent then flash:Destroy() end

                    local eclair = Instance.new("Part")

                    eclair.Size = Vector3.new(1.5, 70, 1.5)

                    eclair.Anchored = true

                    eclair.CanCollide = false

                    eclair.Material = Enum.Material.Neon

                    eclair.BrickColor = BrickColor.new("Cyan")

                    eclair.Position = pos + Vector3.new(0, 35, 0)

                    eclair.Parent = workspace

                    

                    local exp = Instance.new("Explosion")

                    exp.Position = pos

                    exp.BlastRadius = 10

                    exp.Parent = workspace

                    

                    task.delay(0.3, function()

                        if eclair and eclair.Parent then eclair:Destroy() end

                    end)

                end)

            end

        end

        

    elseif choix == 4 then

        -- 4. APPARITION D'UN ATOUT (Boost de vitesse pour fuir)

        print("Événement : Un atout de vitesse est apparu dans l'arène !")

        local atout = Instance.new("Part")

        atout.Size = Vector3.new(3, 3, 3)

        atout.Shape = Enum.PartType.Ball

        atout.Material = Enum.Material.Neon

        atout.BrickColor = BrickColor.new("Lime green") -- Vert brillant pour le bonus

        atout.Position = Vector3.new(math.random(-30, 30), 2, math.random(-30, 30))

        atout.Anchored = true

        atout.Parent = workspace

        

        -- Si un joueur touche l'atout, il court super vite pendant 6 secondes

        local connection

        connection = atout.Touched:Connect(function(hit)

            local character = hit.Parent

            local humanoid = character:FindFirstChildOfClass("Humanoid")

            if humanoid then

                humanoid.WalkSpeed = 32 -- Vitesse doublée !

                atout:Destroy()

                if connection then connection:Disconnect() end

                

                task.delay(6, function()

                    if humanoid and humanoid.Parent then

                        humanoid.WalkSpeed = 16 -- Retour à la normale

                    end

                end)

            end

        end)

        

        -- Disparaît au bout de 10 secondes si personne ne le prend

        task.delay(10, function()

            if atout and atout.Parent then

                atout:Destroy()

            end

        end)

        

    elseif choix == 5 then

        -- 5. SOL GLISSANT

        print("Événement : Patinoire géante !")

        for _, part in ipairs(workspace:GetChildren()) do

            if part:IsA("Part") and part.Size.X > 50 then

                part.Material = Enum.Material.Ice

            end

        end

        task.delay(6, function()

            for _, part in ipairs(workspace:GetChildren()) do

                if part:IsA("Part") and part.Size.X > 50 then

                    part.Material = Enum.Material.SmoothPlastic

                end

            end

        end)

        

    else

        -- 6. LE MONSTRE SOUTERRAIN

        print("Événement : Le monstre surgit !")

        local monstre = Instance.new("Part")

        monstre.Size = Vector3.new(8, 6, 8)

        monstre.Shape = Enum.PartType.Ball

        monstre.Material = Enum.Material.Neon

        monstre.BrickColor = BrickColor.new("Deep blue")

        monstre.Position = Vector3.new(math.random(-30, 30), 3, math.random(-30, 30))

        monstre.Anchored = false

        monstre.Parent = workspace

        

        monstre.Touched:Connect(function(hit)

            local character = hit.Parent

            local humanoid = character:FindFirstChildOfClass("Humanoid")

            if humanoid then

                humanoid.Health = 0

            end

        end)

        

        local startTime = tick()

        local connection

        connection = game:GetService("RunService").Heartbeat:Connect(function()

            if tick() - startTime > 6 or not monstre.Parent then

                if connection then connection:Disconnect() end

                if monstre.Parent then monstre:Destroy() end

                return

            end

            

            local closestPlayer = nil

            local shortestDist = 999

            for _, p in ipairs(Players:GetPlayers()) do

                if p.Character and p.Character:FindFirstChild("HumanoidRootPart") then

                    local dist = (p.Character.HumanoidRootPart.Position - monstre.Position).Magnitude

                    if dist < shortestDist then

                        shortestDist = dist

                        closestPlayer = p.Character.HumanoidRootPart

                    end

                end

            end

            if closestPlayer and monstre.Parent then

                local direction = (closestPlayer.Position - monstre.Position).Unit

                monstre.AssemblyLinearVelocity = direction * 25 + Vector3.new(0, 5, 0)

            end

        end)

    end

end


0 Commentaires

Enregistrer un commentaire

Post a Comment (0)

Plus récente Plus ancienne