Hey so i made this script so it works except one thing why doesnt the particle emmiter smoke doesnt clone to all of the body parts of te target that touched the part
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RemoteEvent = script.Parent.RemoteEvent
local DAMAGE_AMOUNT = 30
local STUN_DURATION = 10
local HITBOX_OFFSET = 3
local ANIMATION_ID = "rbxassetid://112823732160036"
local PARTICLE_EMITTER_NAME = "Smoke"
local function onRemoteEventFired(player)
wait(0.5)
local newPart = Instance.new("Part")
newPart.Size = Vector3.new(65.296, 39.522, 65.478)
newPart.Position = player.Character.HumanoidRootPart.Position
newPart.Anchored = true
newPart.Transparency = 1
newPart.CanCollide = false
newPart.Parent = workspace
local lookVector = player.Character.HumanoidRootPart.CFrame.LookVector
newPart.Position = player.Character.HumanoidRootPart.Position + lookVector * HITBOX_OFFSET
local touchedPlayers = {}
local function onTouch(otherPart)
local character = otherPart.Parent
local humanoid = character:FindFirstChildOfClass("Humanoid")
local rootPart = character:FindFirstChild("HumanoidRootPart")
if humanoid and rootPart and character ~= player.Character then
if not touchedPlayers[character] then
touchedPlayers[character] = true
local animator = humanoid:FindFirstChildOfClass("Animator")
if animator then
local hitAnimation = Instance.new("Animation")
hitAnimation.AnimationId = ANIMATION_ID
local animationTrack = animator:LoadAnimation(hitAnimation)
animationTrack.Looped = true
animationTrack.Priority = Enum.AnimationPriority.Action
animationTrack:Play()
wait(1)
animationTrack:Stop()
end
humanoid.WalkSpeed = 0
humanoid.JumpPower = 0
for i = 1, STUN_DURATION do
humanoid:TakeDamage(DAMAGE_AMOUNT)
wait(1)
end
humanoid.WalkSpeed = 16
humanoid.JumpPower = 50
local particleEmitter = ReplicatedStorage.PosionIvy:FindFirstChild(PARTICLE_EMITTER_NAME)
if particleEmitter then
for _, part in pairs(character:GetChildren()) do
if part:IsA("BasePart") then
local emitterClone = particleEmitter:Clone()
emitterClone.Parent = part
game:GetService("Debris"):AddItem(emitterClone, 10)
end
end
else
print("Particle emitter not found in ReplicatedStorage!")
end
end
end
end
newPart.Touched:Connect(onTouch)
game:GetService("Debris"):AddItem(newPart, 10)
end
RemoteEvent.OnServerEvent:Connect(onRemoteEventFired)