Sungmingamerpro13

fireFlowerServer (Script)

Oct 10th, 2026
27
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
CSS 3.73 KB | None | 0 0
  1. local ReplicatedStorage = game:GetService("ReplicatedStorage")
  2. local Debris = game:GetService("Debris")
  3. local RunService = game:GetService("RunService")
  4.  
  5. local FireballEvent = ReplicatedStorage:WaitForChild("FireballEvent")
  6.  
  7. local FIREBALL_SPEED = 35
  8. local FIREBALL_BOUNCE = 35
  9. local FIREBALL_LIFETIME = 5
  10. local HOMING_DISTANCE = 40
  11.  
  12. FireballEvent.OnServerEvent:Connect(function(player)
  13.  
  14.     local character = player.Character
  15.     if not character then return end
  16.  
  17.     -- Tiene el poder de fuego
  18.     if character:GetAttribute("CanShootFire") ~= true then
  19.         return
  20.     end
  21.  
  22.     -- FireFlower debe estar equipada
  23.     local fireFlower = character:FindFirstChild("fireBall")
  24.     if not fireFlower then
  25.         return
  26.     end
  27.  
  28.     local root = character:FindFirstChild("HumanoidRootPart")
  29.     if not root then return end
  30.  
  31.     -- 🔥 CREAR FIREBALL
  32.     local fireball = Instance.new("Part")
  33.     fireball.Name = "Fireball"
  34.     fireball.Shape = Enum.PartType.Ball
  35.     fireball.Size = Vector3.new(1.2, 1.2, 1.2)
  36.  
  37.     fireball.Color = Color3.fromRGB(255, 170, 0)
  38.     fireball.Material = Enum.Material.Neon
  39.  
  40.     fireball.CanCollide = true
  41.     fireball.CanTouch = true
  42.     fireball.CanQuery = false
  43.     fireball.Anchored = false
  44.  
  45.     fireball.CFrame = root.CFrame * CFrame.new(0, 0, -3)
  46.     fireball.Parent = workspace
  47.  
  48.     -- ✨ Brillo
  49.     local light = Instance.new("PointLight")
  50.     light.Color = Color3.fromRGB(255, 170, 0)
  51.     light.Brightness = 3
  52.     light.Range = 8
  53.     light.Parent = fireball
  54.  
  55.     -- 🔥 Partículas
  56.     local particles = Instance.new("ParticleEmitter")
  57.     particles.Texture = "rbxasset://textures/particles/fire_main.dds"
  58.     particles.Rate = 30
  59.     particles.Lifetime = NumberRange.new(0.15, 0.3)
  60.     particles.Speed = NumberRange.new(1, 3)
  61.     particles.SpreadAngle = Vector2.new(180, 180)
  62.     particles.LightEmission = 1
  63.     particles.Size = NumberSequence.new({
  64.         NumberSequenceKeypoint.new(0, 0.7),
  65.         NumberSequenceKeypoint.new(1, 0)
  66.     })
  67.     particles.Parent = fireball
  68.  
  69.     -- Dirección inicial
  70.     local direction = root.CFrame.LookVector
  71.  
  72.     fireball.AssemblyLinearVelocity =
  73.         direction * FIREBALL_SPEED
  74.         + Vector3.new(0, FIREBALL_BOUNCE, 0)
  75.  
  76.     -- Evitar que mate al propio jugador
  77.     local alreadyHit = false
  78.  
  79.     local connection
  80.  
  81.     connection = RunService.Heartbeat:Connect(function()
  82.  
  83.         if not fireball.Parent then
  84.             connection:Disconnect()
  85.             return
  86.         end
  87.  
  88.         -- Buscar enemigo cercano
  89.         local closestEnemy = nil
  90.         local closestDistance = HOMING_DISTANCE
  91.  
  92.         for _, model in ipairs(workspace:GetChildren()) do
  93.  
  94.             if model:IsA("Model") and model ~= character then
  95.  
  96.                 local humanoid = model:FindFirstChildOfClass("Humanoid")
  97.                 local enemyRoot = model:FindFirstChild("HumanoidRootPart")
  98.  
  99.                 if humanoid and enemyRoot and humanoid.Health > 0 then
  100.  
  101.                     local distance =
  102.                         (enemyRoot.Position - fireball.Position).Magnitude
  103.  
  104.                     if distance < closestDistance then
  105.                         closestDistance = distance
  106.                         closestEnemy = model
  107.                     end
  108.                 end
  109.             end
  110.         end
  111.  
  112.         -- 🎯 Dirigirse al enemigo
  113.         if closestEnemy then
  114.  
  115.             local enemyRoot =
  116.                 closestEnemy:FindFirstChild("HumanoidRootPart")
  117.  
  118.             if enemyRoot then
  119.  
  120.                 local directionToEnemy =
  121.                     (enemyRoot.Position - fireball.Position).Unit
  122.  
  123.                 fireball.AssemblyLinearVelocity =
  124.                     directionToEnemy * FIREBALL_SPEED
  125.             end
  126.         end
  127.     end)
  128.  
  129.     -- 💥 Golpear enemigos
  130.     fireball.Touched:Connect(function(hit)
  131.  
  132.         if alreadyHit then return end
  133.  
  134.         local enemy = hit:FindFirstAncestorOfClass("Model")
  135.  
  136.         if not enemy or enemy == character then
  137.             return
  138.         end
  139.  
  140.         local humanoid =
  141.             enemy:FindFirstChildOfClass("Humanoid")
  142.  
  143.         if humanoid and humanoid.Health > 0 then
  144.  
  145.             alreadyHit = true
  146.  
  147.             -- 💥 Mata al enemigo
  148.             humanoid.Health = 0
  149.  
  150.             fireball:Destroy()
  151.         end
  152.     end)
  153.  
  154.     Debris:AddItem(fireball, FIREBALL_LIFETIME)
  155. end)
  156.  
Advertisement
Add Comment
Please, Sign In to add comment