How to make my skill detect players and do damage?

I made a blaster Skill:

https://gyazo.com/e206deec641768ce747f0eef579ea9ae

Have a simple concept, but i’m having trouble detecting the enemy and causing damage, this skill has 2 detections:

  1. Impact damage, players and NPCS, hit by the Frontal part of the skill will receive impact damage.
  2. Players and NPCS who stay within the skill area will receive AoE damage (Damage per Second)

But that inst the Skill hitbox, that is only the effects on client, the is the real hitbox on server:

https://gyazo.com/1c79381d2f132b95b51620cf00e8c3aa

So i tried use Touched and GetTouchingParts on that way:

Part.Touched:Connect(function() end) --Cause the part is cancollide off while Part do for i,v in pairs(Part:GetTouchingParts()) do print(v.Name) end RunService.HeartBeat:Wait() end 

But for any reason only print “BetterBlasePlate”, that is because the part is moving so fast, and GetTouchingParts() cant detect that fast, so i need a another way to make detect correctly, i tried A LOT but i cant, if anyone can helpme found a better way.

That is the full Code:

 --//Services local RunService = game:GetService("RunService") local ReplicatedStorage = game:GetService("ReplicatedStorage") local TweenService = game:GetService("TweenService") local ServerStorage = game:GetService("ServerStorage") local Players = game:GetService("Players") --//Modules local Casting = require(game:GetService("ServerStorage").Modules.CheckCastingSkill) local CheckSkill = require(ServerStorage.Modules.CheckCanSkill) local Damage = require(ServerStorage.Modules.DamageManager) local Stun = require(game:GetService("ServerStorage").BadEffects.Stun) local Shield = require(game:GetService("ServerStorage").Modules.Shields) local LerpAP = require(game:GetService("ReplicatedStorage").Modules.LerpAPI) local DelayManager = require(ServerStorage.Modules.DelayManager) local Effects = require(ServerStorage.Modules.Effects) local Skills = require(script.Parent.Parent.Script.Skills) local DamageManager = require(ServerStorage.Modules.DamageManager) --// Remotes Event local StunEvent = ServerStorage.Events.Stun local PureBlaster = ReplicatedStorage.Skills.Pure.PureBlaster.Remotes.PureBlaster local PureEffects = ReplicatedStorage.Skills.Pure.PureBlaster.Remotes.PureEffects local PureClients = ReplicatedStorage.Skills.Pure.PureBlaster.Remotes.PureClients local PureB = {} PureB.__index = PureB function PureB.New(player,T,D,slot,Stage) if Stage == 2 then Casting.RemoveCast(player.UserId,0) Skills.Cooldown(player,0,"PureBlaster",slot) else local newPure = {} setmetatable(newPure,PureB) newPure.Name = "PureBlaster" newPure.T = T newPure.D = D newPure.Stage = 1 newPure.Slot = slot newPure.Player = player newPure.Size = 100 newPure.Particles = ReplicatedStorage.Skills.Pure.PureBlaster.Meshes.Particles:Clone() newPure.Particles.Parent = workspace newPure.Particles.PureParticle.Parent = newPure.Player.Character:WaitForChild("LeftHand") newPure.Particles.PureParticle2.Parent = newPure.Player.Character:WaitForChild("RightHand") newPure.Model = ReplicatedStorage.Skills.Pure.PureBlaster.Meshes.Model:Clone() newPure.Model.Parent = workspace newPure.Model.Name = player.Name.." PureBlaster" newPure.Model.BlasterP.Transparency = 0.8 newPure.Model.BlasterP.Size = newPure.Model.BlasterP.Size + Vector3.new(5,0,0) print("IS here cframe "..newPure.Player.Character:WaitForChild("HumanoidRootPart").CFrame.X..newPure.Player.Character:WaitForChild("HumanoidRootPart").CFrame.Y..newPure.Player.Character:WaitForChild("HumanoidRootPart").CFrame.Z) print("SENSE ?"..DelayManager.getPredict(100,0.2,T,D)) newPure.Model.BlasterP.CFrame = newPure.Player.Character:WaitForChild("HumanoidRootPart").CFrame * CFrame.new(0,3,-2) return newPure end end function PureB:Damage(Part) while Part do for i,v in pairs(Part:GetTouchingParts())do if not v:IsDescendantOf(self.Player.Character) then print(v.Name) end end RunService.Heartbeat:Wait() end end function PureB:Finish() print("FINISHDIN GALL") Casting.RemoveCast(self.Player.UserId,0) Skills.Cooldown(self.Player,10,self.Name,self.Slot) self:Destroy() end function PureB:Destroy() self.Model:Destroy() self = nil end function PureB:CreateEffects(Values) local Players = game:GetService("Players"):GetPlayers() if self.Stage == 1 then self.Stage = 2 print("sseting stage 2") elseif self.Stage == 2 then PureEffects:FireAllClients(time(),self.Player.Character:WaitForChild("HumanoidRootPart").CFrame,2,Values,self.Player.Character:WaitForChild("Humanoid")) self.Stage = 0 self.Player.Character:WaitForChild("LeftHand").PureParticle.Rate = 0 self.Player.Character:WaitForChild("RightHand").PureParticle2.Rate = 0 wait(0.5) self.Player.Character:WaitForChild("LeftHand").PureParticle:Destroy() self.Player.Character:WaitForChild("RightHand").PureParticle2:Destroy() print("sseting stage 0") end end function PureB:Fire() self.Model.BlasterP.Touched:Connect(function() end) coroutine.wrap(function() self:Damage(self.Model.BlasterP) end)() wait(0.2) self.Model.BlasterP.CFrame = self.Player.Character:WaitForChild("HumanoidRootPart").CFrame * CFrame.new(0,3,-2) self.Model.BlasterP.Orientation = self.Model.BlasterP.Orientation + Vector3.new(0,-90,0) local Tween = TweenService:Create(self.Model.BlasterP,TweenInfo.new(0.2),{ CFrame = self.Model.BlasterP.CFrame * CFrame.new(-95,0,0) }) Tween.Completed:Connect(function() self:Finish() end) self:CreateEffects({0.2}) Tween:Play() end function PureB:CanFire() if self.Stage == 1 then print("STAGE 1") self:CreateEffects() elseif self.Stage == 2 then print("STAGE 2") self:Fire() else return end end return PureB 

I would suggest using this module!

Raycast Hitbox Module: For all your melee needs!

1 Like

That Will work with my hitbox? Raycast are thin and my hitbox is 5,15,15

2 Likes

If you look at it you will see what I mean. It uses multiple raycasts. Just check it out!

2 Likes