local remote = game.ReplicatedStorage.RemoteEvent
local tweenservice = game:GetService("TweenService")
local RS = game:GetService("ReplicatedStorage")
local Count = 15
local damage = 1
remote.OnServerEvent:Connect(function(player, action, pos)
local function Blacklisted()
for i, a in pairs(player.Character:GetDescendants()) do
if a:IsA("MeshPart") or a:IsA("Part") then
a.CanTouch = false
end
end
end
local function whitelist ()
for i, a in pairs(player.Character:GetDescendants()) do
if a:IsA("MeshPart") or a:IsA("Part") then
a.CanTouch = true
end
end
end
if action == "Kick" then
Blacklisted()
local proticle = RS.particles.Exl:Clone()
proticle.CFrame = player.Character:WaitForChild("HumanoidRootPart").CFrame
proticle.Parent = game.Workspace.FX
proticle.Orientation = Vector3.new(0.002, -0.001, 0)
proticle.Transparency = 1
local hitbox = Instance.new("Part")
hitbox.CanCollide = false
hitbox.CanTouch = true
hitbox.Parent = game.Workspace.FX
hitbox.Transparency = 0.9
hitbox.BrickColor = BrickColor.new("Really red")
hitbox.Size = Vector3.new(12.6, 6.3, 12.3)
hitbox.Touched:Connect(function(hit)
local humanoid = hit.Parent:FindFirstChild("Humanoid")
if humanoid and hit.Parent.Name ~= player.Name then
humanoid:TakeDamage(damage)
end
end)
proticle.Touched:Connect(function(hit)
for i, v in pairs(proticle.Attachment:GetChildren()) do
v:Emit(Count)
game:GetService("Debris"):AddItem(v, 3)
game:GetService("Debris"):AddItem(proticle, 1)
game:GetService("Debris"):AddItem(hitbox, 0.5)
whitelist()
proticle.Anchored = true
hitbox.Anchored = true
end
end)
local tween = tweenservice:Create(proticle, TweenInfo.new(0.1), {Position = pos})
tween:Play()
hitbox.Position = pos
end
end)
It looks fine to me but I fixed some lines up for you.
local remote = game.ReplicatedStorage.RemoteEvent
local tweenservice = game:GetService("TweenService")
local RS = game:GetService("ReplicatedStorage")
local Count = 15
local damage = 1
remote.OnServerEvent:Connect(function(player, action, pos)
local function Blacklisted()
for _, a in pairs(player.Character:GetDescendants()) do
if a:IsA("MeshPart") or a:IsA("Part") then
a.CanTouch = false
end
end
end
local function whitelist()
for _, a in pairs(player.Character:GetDescendants()) do
if a:IsA("MeshPart") or a:IsA("Part") then
a.CanTouch = true
end
end
end
if action == "Kick" then
Blacklisted()
local particle = RS.Particles.Exl:Clone()
particle.CFrame = player.Character:WaitForChild("HumanoidRootPart").CFrame
particle.Parent = game.Workspace.FX
particle.Orientation = Vector3.new(0.002, -0.001, 0)
particle.Transparency = 1
local hitbox = Instance.new("Part")
hitbox.CanCollide = false
hitbox.CanTouch = true
hitbox.Parent = game.Workspace.FX
hitbox.Transparency = 0.9
hitbox.BrickColor = BrickColor.new("Really red")
hitbox.Size = Vector3.new(12.6, 6.3, 12.3)
hitbox.Touched:Connect(function(hit)
local humanoid = hit.Parent:FindFirstChild("Humanoid")
if humanoid and hit.Parent.Name ~= player.Name then
humanoid:TakeDamage(damage)
end
end)
particle.Touched:Connect(function(hit)
for _, v in pairs(particle.Attachment:GetChildren()) do
v:Emit(Count)
game:GetService("Debris"):AddItem(v, 3)
end
game:GetService("Debris"):AddItem(particle, 1)
game:GetService("Debris"):AddItem(hitbox, 0.5)
whitelist()
particle.Anchored = true
hitbox.Anchored = true
end)
local tween = tweenservice:Create(particle, TweenInfo.new(0.1), { Position = pos })
tween:Play()
hitbox.Position = pos
end
end)
If you mean your VFX is going after the mouse than being in the red circle then just save the red circles position and put the VFX to position to that.
the vfx isn’t emitting when i spawn the hitbox on my right arm
The issue is when i spawn the part / hitbox next to a humanoid right arm it doesn’t count and it does not emit.
Have you checked the explorer? Is it spawing there? if so then check the position, else I am not sure of what’s happening.
All you particles are in a Attachment right?
Yea the particles indeed are all in the attachment
It seems like the issue might be related to how you’re checking for humanoid parts in the Touched
event of the hitbox
. In your current implementation, you are checking if the touched part has a direct parent named “Humanoid,” which might not be the case if the humanoid’s right arm is touched.
remote.OnServerEvent:Connect(function(player, action, pos)
local function Blacklisted()
for _, descendant in pairs(player.Character:GetDescendants()) do
if descendant:IsA("MeshPart") or descendant:IsA("Part") then
descendant.CanTouch = false
end
end
end
local function Whitelist()
for _, descendant in pairs(player.Character:GetDescendants()) do
if descendant:IsA("MeshPart") or descendant:IsA("Part") then
descendant.CanTouch = true
end
end
end
if action == "Kick" then
Blacklisted()
local particle = RS.particles.Exl:Clone()
particle.CFrame = player.Character:WaitForChild("HumanoidRootPart").CFrame
particle.Parent = game.Workspace.FX
particle.Orientation = Vector3.new(0.002, -0.001, 0)
particle.Transparency = 1
local hitbox = Instance.new("Part")
hitbox.CanCollide = false
hitbox.CanTouch = true
hitbox.Parent = game.Workspace.FX
hitbox.Transparency = 0.9
hitbox.BrickColor = BrickColor.new("Really red")
hitbox.Size = Vector3.new(12.6, 6.3, 12.3)
hitbox.Touched:Connect(function(hit)
local humanoid = hit.Parent:FindFirstChildOfClass("Humanoid")
if humanoid and humanoid.Parent and humanoid.Parent.Name ~= player.Name then
humanoid:TakeDamage(damage)
end
end)
particle.Touched:Connect(function(hit)
for _, v in pairs(particle.Attachment:GetChildren()) do
v:Emit(Count)
game:GetService("Debris"):AddItem(v, 3)
game:GetService("Debris"):AddItem(particle, 1)
game:GetService("Debris"):AddItem(hitbox, 0.5)
Whitelist()
particle.Anchored = true
hitbox.Anchored = true
end
end)
local tween = tweenservice:Create(particle, TweenInfo.new(0.1), {Position = pos})
tween:Play()
hitbox.Position = pos
end
end)
I changed the hitbox.Touched
event to find the humanoid using FindFirstChildOfClass("Humanoid")
and ensured that the humanoid is part of a player’s character and not the player’s own character.
I tried your script it still doesn’t fix the problem, i think the problem is the touched events like you said or it can maybe the the functions i created i mainly created the blacklist function so when i click z it doesn’t run the touched event for my humanoid.
Okay well what are you mainly trying to do.
Here is a better video that can probably help solve the issue.
Are you trying to damage the players?
nah i am trying to the fix the issue with when the hitbox / part touches a humanoid right arm it doesn’t emit or anything it just glitches
Like it doesn’t clone the particles??
It does not emit the particles