-
What do you want to achieve? Keep it simple and clear!
I am trying to make a fireball barrage, but i want it to damage the enemy once. -
What is the issue? Include screenshots / videos if possible!
Problem is the server script reacts to all fireballs at once, so making a seperate cooldown seems hard. -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I tried searching for many ways to make the damaging work, but to no avail.
Server script:
local ts = game:GetService("TweenService")
local debris = game:GetService("Debris")
local run = game:GetService("RunService")
script.Parent.RemoteEvent.OnServerEvent:Connect(function(player, Mousehit)
local explode = false
local fireball = Instance.new("Part", game.Workspace.Effects)
fireball.Shape = "Ball"
fireball.Color = Color3.fromRGB(255, 255, 89)
fireball.Size = Vector3.new(1, 1, 1)
local humanoidRootPart = player.Character.HumanoidRootPart
local lookVector = (Mousehit.Position - humanoidRootPart.Position).unit
local offset = 5
fireball.CFrame = CFrame.new(humanoidRootPart.Position + lookVector * offset, humanoidRootPart.Position + lookVector * (offset + 1))
fireball.Material = Enum.Material.Neon
fireball.Anchored = false
fireball.Name = player.Name.." fireball"
fireball.CanCollide = false
local fireballmesh = Instance.new("SpecialMesh", fireball)
fireballmesh.MeshType = "Sphere"
fireballmesh.Scale = Vector3.new(1, 1, 1)
local fireballeffect = script.ParticleEmitter:Clone()
fireballeffect.Parent = fireball
fireballeffect.Enabled = true
local velocity = Instance.new("BodyVelocity", fireball)
velocity.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
velocity.Velocity = Mousehit.lookVector * 50
fireball.Touched:Connect(function(hit)
local projectile = fireball
if hit:IsA("BasePart") then
if hit.Parent.Name == player.Name or hit.Parent:IsA("Accessory") or hit.Parent.Name == "Effects" then
else
if explode == false then
explode = true
fireballeffect.Enabled = false
fireball.Transparency = 1
fireball.CanCollide = false
fireball.Anchored = true
local explosionmain = Instance.new("Part", game.Workspace.Effects)
explosionmain.Shape = "Ball"
explosionmain.Color = Color3.fromRGB(255, 255, 89)
explosionmain.Size = Vector3.new(0.001, 0.001, 0.001)
explosionmain.CFrame = fireball.CFrame
explosionmain.Material = Enum.Material.Neon
explosionmain.Anchored = true
explosionmain.Name = "ExplosionMain"
local explosionmainvalue = Instance.new("BoolValue", explosionmain)
local explosionout = Instance.new("Part", game.Workspace.Effects)
explosionout.Shape = "Ball"
explosionout.Color = Color3.fromRGB(255, 255, 127)
explosionout.Size = Vector3.new(0.001, 0.001, 0.001)
explosionout.CFrame = fireball.CFrame
explosionout.Material = Enum.Material.Neon
explosionout.Anchored = true
explosionmain.CanCollide = false
explosionout.CanCollide = false
explosionout.Transparency = 0.9
explosionout.Name = "ExplosionOut"
local wavecreator = coroutine.create(function()
local waves = 2
repeat
waves = waves - 1
local rand = 1
local rands = math.random(7, 10)
local shockwave = Instance.new("Part", game.Workspace.Effects)
shockwave.Shape = "Ball"
shockwave.Color = Color3.fromRGB(255, 255, 127)
shockwave.Size = Vector3.new(0.001, 0.001, 0.001)
shockwave.CFrame = explosionmain.CFrame * CFrame.Angles(math.random(0, 180), math.random(0, 180), math.random(0, 180))
shockwave.Material = Enum.Material.Neon
shockwave.Anchored = true
shockwave.Transparency = 0.6
shockwave.CanCollide = false
shockwave.Name = "Shockwave"
local shockwavemesh = Instance.new("SpecialMesh", shockwave)
shockwavemesh.MeshType = "FileMesh"
shockwavemesh.MeshId = "rbxassetid://489415447"
shockwavemesh.Scale = Vector3.new(0, 0, 0)
ts:Create(shockwavemesh, TweenInfo.new(rand), {Scale = Vector3.new(rands, 0, rands)}):Play()
ts:Create(shockwave, TweenInfo.new(rand), {Transparency = 1}):Play()
local spin = coroutine.create(function()
while true do
shockwave.CFrame = shockwave.CFrame * CFrame.Angles(0, 0.1, 0)
wait()
end
end)
coroutine.resume(spin)
debris:AddItem(shockwave, rand)
until waves == 0
end)
coroutine.resume(wavecreator)
local sound = Instance.new("Sound", explosionmain)
sound.SoundId = "rbxassetid://5265570669"
sound.MaxDistance = 350
sound.Volume = 10
sound.PlaybackSpeed = 1
sound:Play()
explosionmain.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") and hit.Parent.Name ~= player.Name then
if hit.Parent:FindFirstChild("WaterbulletsAH"..player.Name) == nil then
local AH = Instance.new("BoolValue",hit.Parent)
AH.Name = "WaterbulletsAH"..player.Name
debris:AddItem(AH, 0.1)
hit.Parent.Humanoid:TakeDamage(10)
end
end
end)
ts:Create(explosionmain, TweenInfo.new(0.1), {Size = Vector3.new(5, 5, 5)}):Play()
ts:Create(explosionout, TweenInfo.new(0.1), {Size = Vector3.new(7, 7, 7)}):Play()
wait(0.2)
ts:Create(explosionmain, TweenInfo.new(0.1), {Transparency = 1}):Play()
ts:Create(explosionout, TweenInfo.new(0.1), {Transparency = 1}):Play()
debris:AddItem(explosionout, 1)
debris:AddItem(explosionmain, 3)
debris:AddItem(fireball, 1)
else
end
end
end
end)
end)
Local script:
local db = false
local timer = 15
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
script.Parent.Activated:Connect(function(IsTyping)
if IsTyping then return end
if db == false then
db = true
local barrage = coroutine.create(function()
local bullets = 3
repeat
bullets = bullets - 1
script.Parent.RemoteEvent:FireServer(mouse.Hit)
wait()
until bullets == 0
end)
coroutine.resume(barrage)
wait(0.3)
for i = 1, 15 do
timer = timer - 1
script.Parent.Name = "Light Devastation ("..timer..")"
wait(1)
end
timer = 15
script.Parent.Name = "Light Devastation"
db = false
else
end
end)