I have two scripts, one is for the FireServer script and the other is the OnServerEvent script, and so I put the part that will deal damage to an enemy by 50 when touched in the OnServerEvent script. But it doesn't seem to work (I'm using the Touched Event), everything seems fine, the only problem is that it doesn't deal any damage.
Can you guys kindly look at the script below to see if there are any problems?
I'm seeking for help... :C The script below is the OnServerEvent script
--// System local ReplicatedStorage = game:GetService("ReplicatedStorage") --// Variables local Explo = ReplicatedStorage.ExploEvent --// Settings local Damage = 50 Explo.OnServerEvent:Connect(function(plr, Mouse) local char = plr.Character or plr.CharacterAdded:Wait() --[==[ Instances --// Explo 1 --]==] local Explosion1 = Instance.new("Part") Explosion1.BrickColor = BrickColor.new("Bright red") Explosion1.Anchored = true Explosion1.CanCollide = false Explosion1.Shape = Enum.PartType.Ball Explosion1.Material = Enum.Material.Neon Explosion1.Name = "Explosion1" Explosion1.Parent = game.Workspace Explosion1.Size = Vector3.new(5,5,5) Explosion1.CFrame = char.HumanoidRootPart.CFrame --// Explo 2 local Explosion2 = Instance.new("Part") Explosion2.BrickColor = BrickColor.new("Neon orange") Explosion2.Transparency = .1 Explosion2.Anchored = true Explosion2.CanCollide = false Explosion2.Shape = Enum.PartType.Ball Explosion2.Material = Enum.Material.Neon Explosion2.Name = "Explosion2" Explosion2.Parent = game.Workspace Explosion2.Size = Vector3.new(6.5,6.5,6.5) Explosion2.CFrame = char.HumanoidRootPart.CFrame --// EXPLOSION EFFECT AND OTHER EFFECTUS ------------------- local ExplosionEffect = Instance.new("Explosion") ExplosionEffect.BlastPressure = 0 ExplosionEffect.BlastRadius = 8 ExplosionEffect.DestroyJointRadiusPercent = 0 ExplosionEffect.Parent = game.Workspace ExplosionEffect.Position = char.HumanoidRootPart.Position local LavaEffect = Instance.new("Part") LavaEffect.Anchored = true LavaEffect.CanCollide = false LavaEffect.BrickColor = BrickColor.new("Maroon") LavaEffect.Material = Enum.Material.Neon LavaEffect.Size = Vector3.new(5.5,1,5.5) LavaEffect.Parent = game.Workspace LavaEffect.Name = "LavaEffect" LavaEffect.CFrame = char.HumanoidRootPart.CFrame * CFrame.new(0,-3,0) --// PARTICLE FOR LAVA local LavaPartice = ReplicatedStorage.LavaParticle:Clone() LavaPartice.Parent = LavaEffect -------------------------------------------------------------- --// Debris ------------------------------------------------ -- Back local ExplosionDebris1 = Instance.new("WedgePart") ExplosionDebris1.Anchored = true ExplosionDebris1.CanCollide = false ExplosionDebris1.BrickColor = BrickColor.new("Really red") ExplosionDebris1.Material = Enum.Material.Neon ExplosionDebris1.Name = "ExplosionDebris1" ExplosionDebris1.Parent = game.Workspace ExplosionDebris1.Size = Vector3.new(4, 1.78, 3.42) ExplosionDebris1.CFrame = char.HumanoidRootPart.CFrame * CFrame.new(0,-2,4) -- Front local ExplosionDebris2 = Instance.new("WedgePart") ExplosionDebris2.Anchored = true ExplosionDebris2.CanCollide = false ExplosionDebris2.BrickColor = BrickColor.new("Really red") ExplosionDebris2.Material = Enum.Material.Neon ExplosionDebris2.Name = "ExplosionDebris2" ExplosionDebris2.Parent = game.Workspace ExplosionDebris2.Size = Vector3.new(4, 1.78, 3.42) ExplosionDebris2.CFrame = char.HumanoidRootPart.CFrame * CFrame.new(0,-2,-4) * CFrame.Angles(0,math.rad (180),0) -- Left local ExplosionDebris3 = Instance.new("WedgePart") ExplosionDebris3.Anchored = true ExplosionDebris3.CanCollide = false ExplosionDebris3.BrickColor = BrickColor.new("Really red") ExplosionDebris3.Material = Enum.Material.Neon ExplosionDebris3.Name = "ExplosionDebris3" ExplosionDebris3.Parent = game.Workspace ExplosionDebris3.Size = Vector3.new(4, 1.78, 3.42) ExplosionDebris3.CFrame = char.HumanoidRootPart.CFrame * CFrame.new(-4,-2,0) * CFrame.Angles(0,math.rad (-90),0) -- Right local ExplosionDebris4 = Instance.new("WedgePart") ExplosionDebris4.Anchored = true ExplosionDebris4.CanCollide = false ExplosionDebris4.BrickColor = BrickColor.new("Really red") ExplosionDebris4.Material = Enum.Material.Neon ExplosionDebris4.Name = "ExplosionDebris4" ExplosionDebris4.Parent = game.Workspace ExplosionDebris4.Size = Vector3.new(4, 1.78, 3.42) ExplosionDebris4.CFrame = char.HumanoidRootPart.CFrame * CFrame.new(4,-2,0) * CFrame.Angles(0,math.rad (90),0) --// Damage BOXXXXXX local DamageBox = Instance.new("Part") DamageBox.Transparency = .5 DamageBox.BrickColor = BrickColor.new("Bright red") DamageBox.Anchored = true DamageBox.CanCollide = false DamageBox.Shape = Enum.PartType.Ball DamageBox.Material = Enum.Material.Neon DamageBox.Name = "DamageBox" DamageBox.Parent = game.Workspace DamageBox.Size = Vector3.new(9,9,9) DamageBox.CFrame = char.HumanoidRootPart.CFrame wait() local Debounce = false DamageBox.Touched:Connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") and hit.Parent.Name ~= plr.Name and Debounce == false then Debounce = true local Enemy = hit.Parent.Humanoid Enemy:TakeDamage(Damage) wait() DamageBox:Destroy() wait(1) Debounce = false end end) for i = 1,40 do Explosion1.Transparency = Explosion1.Transparency + .125 Explosion2.Transparency = Explosion2.Transparency + .125 Explosion1.Size = Vector3.new(Explosion1.Size.X + 1.5, Explosion1.Size.Y + 1.5, Explosion1.Size.Z + 1.5) Explosion2.Size = Vector3.new(Explosion2.Size.X + 1.5, Explosion2.Size.Y + 1.5, Explosion2.Size.Z + 1.5) wait() if Explosion1.Transparency == 1 then Explosion1:Destroy() Explosion2:Destroy() ExplosionEffect:Destroy() repeat ExplosionDebris1.Transparency = ExplosionDebris1.Transparency + .03125 ExplosionDebris2.Transparency = ExplosionDebris2.Transparency + .03125 ExplosionDebris3.Transparency = ExplosionDebris3.Transparency + .03125 ExplosionDebris4.Transparency = ExplosionDebris4.Transparency + .03125 LavaEffect.Transparency = LavaEffect.Transparency + .03125 wait(.1) until ExplosionDebris4.Transparency == 1 ExplosionDebris1:Destroy() ExplosionDebris2:Destroy() ExplosionDebris3:Destroy() ExplosionDebris4:Destroy() LavaEffect:Destroy() LavaPartice:Destroy() end end end)
--// System local ReplicatedStorage = game:GetService("ReplicatedStorage") --// Variables local Explo = ReplicatedStorage.ExploEvent --// Settings local Damage = 50 Explo.OnServerEvent:Connect(function(plr, Mouse) local char = plr.Character or plr.CharacterAdded:Wait() --[==[ Instances --// Explo 1 --]==] local Explosion1 = Instance.new("Part") Explosion1.BrickColor = BrickColor.new("Bright red") Explosion1.Anchored = true Explosion1.CanCollide = false Explosion1.Shape = Enum.PartType.Ball Explosion1.Material = Enum.Material.Neon Explosion1.Name = "Explosion1" Explosion1.Parent = game.Workspace Explosion1.Size = Vector3.new(5,5,5) Explosion1.CFrame = char.HumanoidRootPart.CFrame --// Explo 2 local Explosion2 = Instance.new("Part") Explosion2.BrickColor = BrickColor.new("Neon orange") Explosion2.Transparency = .1 Explosion2.Anchored = true Explosion2.CanCollide = false Explosion2.Shape = Enum.PartType.Ball Explosion2.Material = Enum.Material.Neon Explosion2.Name = "Explosion2" Explosion2.Parent = game.Workspace Explosion2.Size = Vector3.new(6.5,6.5,6.5) Explosion2.CFrame = char.HumanoidRootPart.CFrame --// EXPLOSION EFFECT AND OTHER EFFECTUS ------------------- local ExplosionEffect = Instance.new("Explosion") ExplosionEffect.BlastPressure = 0 ExplosionEffect.BlastRadius = 8 ExplosionEffect.DestroyJointRadiusPercent = 0 ExplosionEffect.Parent = game.Workspace ExplosionEffect.Position = char.HumanoidRootPart.Position local LavaEffect = Instance.new("Part") LavaEffect.Anchored = true LavaEffect.CanCollide = false LavaEffect.BrickColor = BrickColor.new("Maroon") LavaEffect.Material = Enum.Material.Neon LavaEffect.Size = Vector3.new(5.5,1,5.5) LavaEffect.Parent = game.Workspace LavaEffect.Name = "LavaEffect" LavaEffect.CFrame = char.HumanoidRootPart.CFrame * CFrame.new(0,-3,0) --// PARTICLE FOR LAVA local LavaPartice = ReplicatedStorage.LavaParticle:Clone() LavaPartice.Parent = LavaEffect -------------------------------------------------------------- --// Debris ------------------------------------------------ -- Back local ExplosionDebris1 = Instance.new("WedgePart") ExplosionDebris1.Anchored = true ExplosionDebris1.CanCollide = false ExplosionDebris1.BrickColor = BrickColor.new("Really red") ExplosionDebris1.Material = Enum.Material.Neon ExplosionDebris1.Name = "ExplosionDebris1" ExplosionDebris1.Parent = game.Workspace ExplosionDebris1.Size = Vector3.new(4, 1.78, 3.42) ExplosionDebris1.CFrame = char.HumanoidRootPart.CFrame * CFrame.new(0,-2,4) -- Front local ExplosionDebris2 = Instance.new("WedgePart") ExplosionDebris2.Anchored = true ExplosionDebris2.CanCollide = false ExplosionDebris2.BrickColor = BrickColor.new("Really red") ExplosionDebris2.Material = Enum.Material.Neon ExplosionDebris2.Name = "ExplosionDebris2" ExplosionDebris2.Parent = game.Workspace ExplosionDebris2.Size = Vector3.new(4, 1.78, 3.42) ExplosionDebris2.CFrame = char.HumanoidRootPart.CFrame * CFrame.new(0,-2,-4) * CFrame.Angles(0,math.rad (180),0) -- Left local ExplosionDebris3 = Instance.new("WedgePart") ExplosionDebris3.Anchored = true ExplosionDebris3.CanCollide = false ExplosionDebris3.BrickColor = BrickColor.new("Really red") ExplosionDebris3.Material = Enum.Material.Neon ExplosionDebris3.Name = "ExplosionDebris3" ExplosionDebris3.Parent = game.Workspace ExplosionDebris3.Size = Vector3.new(4, 1.78, 3.42) ExplosionDebris3.CFrame = char.HumanoidRootPart.CFrame * CFrame.new(-4,-2,0) * CFrame.Angles(0,math.rad (-90),0) -- Right local ExplosionDebris4 = Instance.new("WedgePart") ExplosionDebris4.Anchored = true ExplosionDebris4.CanCollide = false ExplosionDebris4.BrickColor = BrickColor.new("Really red") ExplosionDebris4.Material = Enum.Material.Neon ExplosionDebris4.Name = "ExplosionDebris4" ExplosionDebris4.Parent = game.Workspace ExplosionDebris4.Size = Vector3.new(4, 1.78, 3.42) ExplosionDebris4.CFrame = char.HumanoidRootPart.CFrame * CFrame.new(4,-2,0) * CFrame.Angles(0,math.rad (90),0) --// Damage BOXXXXXX local DamageBox = Instance.new("Part") DamageBox.Transparency = .5 DamageBox.BrickColor = BrickColor.new("Bright red") DamageBox.Anchored = true DamageBox.CanCollide = false DamageBox.Shape = Enum.PartType.Ball DamageBox.Material = Enum.Material.Neon DamageBox.Name = "DamageBox" DamageBox.Parent = game.Workspace DamageBox.Size = Vector3.new(9,9,9) DamageBox.CFrame = char.HumanoidRootPart.CFrame wait() local Debounce = false DamageBox.Touched:Connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") then if not Debounce then Debounce = true local Enemy = hit.Parent.Humanoid Enemy.Health = Enemy.Health - Damage wait() DamageBox:Destroy() wait(1) Debounce = false end end end) for i = 1,40 do Explosion1.Transparency = Explosion1.Transparency + .125 Explosion2.Transparency = Explosion2.Transparency + .125 Explosion1.Size = Vector3.new(Explosion1.Size.X + 1.5, Explosion1.Size.Y + 1.5, Explosion1.Size.Z + 1.5) Explosion2.Size = Vector3.new(Explosion2.Size.X + 1.5, Explosion2.Size.Y + 1.5, Explosion2.Size.Z + 1.5) wait() if Explosion1.Transparency == 1 then Explosion1:Destroy() Explosion2:Destroy() ExplosionEffect:Destroy() repeat ExplosionDebris1.Transparency = ExplosionDebris1.Transparency + .03125 ExplosionDebris2.Transparency = ExplosionDebris2.Transparency + .03125 ExplosionDebris3.Transparency = ExplosionDebris3.Transparency + .03125 ExplosionDebris4.Transparency = ExplosionDebris4.Transparency + .03125 LavaEffect.Transparency = LavaEffect.Transparency + .03125 wait(.1) until ExplosionDebris4.Transparency == 1 ExplosionDebris1:Destroy() ExplosionDebris2:Destroy() ExplosionDebris3:Destroy() ExplosionDebris4:Destroy() LavaEffect:Destroy() LavaPartice:Destroy() end end end)
i think i fixed that damage part for u, check it out and upvote if it works, u only did a few wrong things but not much