i am trying to make a function that "dusts" a player (think infinity war) when called on a player, and it has a function inside it that dusts a single part, which is used in a for loop to dust every part, i cant dust them without using spawn() or else the dusting will take very long, the DustPart(Part) function is being called via spawn(DustPart)(v), but DustPart thinks v is a number when it an instance?
function DustPlayer(Victim)
local PartToDust
local function DustPart(Part)
local GrainyParticles = Instance.new("ParticleEmitter")
GrainyParticles.EmissionDirection = Enum.NormalId.Left
GrainyParticles.Lifetime = NumberRange.new(1)
GrainyParticles.Rate = 50
GrainyParticles.Rotation = NumberRange.new(-360,360)
GrainyParticles.RotSpeed = NumberRange.new(-360,360)
GrainyParticles.Speed = NumberRange.new(5)
GrainyParticles.Size = NumberSequence.new(2)
GrainyParticles.Acceleration = Vector3.new(-15,10,0)
GrainyParticles.Color = ColorSequence.new(Color3.fromRGB(111,98,92))
GrainyParticles.LightInfluence = 1
GrainyParticles.Transparency = NumberSequence.new({
NumberSequenceKeypoint.new(0,1,0),
NumberSequenceKeypoint.new(0.15,0.1,0),
NumberSequenceKeypoint.new(0.5,0.7,0),
NumberSequenceKeypoint.new(1,1,0)
})
GrainyParticles.ZOffset = 0.1
GrainyParticles.Texture = "rbxassetid://363275192"
GrainyParticles.Parent = Part
local SoftParticles = Instance.new("ParticleEmitter")
SoftParticles.EmissionDirection = Enum.NormalId.Left
SoftParticles.Lifetime = NumberRange.new(1)
SoftParticles.Rate = 50
SoftParticles.Rotation = NumberRange.new(-360,360)
SoftParticles.RotSpeed = NumberRange.new(-360,360)
SoftParticles.Speed = NumberRange.new(5)
SoftParticles.Size = NumberSequence.new(2)
SoftParticles.Acceleration = Vector3.new(-15,10,0)
SoftParticles.Color = ColorSequence.new(Color3.fromRGB(158,158,158))
SoftParticles.LightInfluence = 1
SoftParticles.Transparency = NumberSequence.new({
NumberSequenceKeypoint.new(0,1,0),
NumberSequenceKeypoint.new(0.15,0.1,0),
NumberSequenceKeypoint.new(0.5,0.7,0),
NumberSequenceKeypoint.new(1,1,0)
})
SoftParticles.Texture = "rbxassetid://3176154112"
SoftParticles.Parent = Part
local Tween = TService:Create(Part,DustInfo,DustDict)
Tween:Play()
wait(2)
Part.Transparency = 1
Part.CanCollide = false
SoftParticles.Enabled = false
GrainyParticles.Enabled = false
wait(1)
end
local Sound = Instance.new("Sound")
Sound.PlayOnRemove = true
Sound.Volume = 5
Sound.SoundId = Sounds.Dustings[math.random(1,#Sounds.Dustings)]
Sound.Parent = Victim.Character.Head
Sound:Destroy()
for k,v in pairs(Victim.Character:GetChildren()) do
if v:IsA("BasePart") then
spawn(DustPart)(v)
if v.Name == "Head" then
v:FindFirstChildOfClass("Decal"):Destroy()
end
wait(0.5)
end
if v:IsA("Accoutrement") then
v.Handle:FindFirstChildOfClass("SpecialMesh").TextureId = ""
DustPart(v.Handle)
wait(0.5)
end
wait()
end
end

1 comment
IT WORKED! thanks for your help!