I used debounce but I need this code to be able to only run once yet it runs 6 times?
Is there any solution to this? Thanks.
This script clones instances from replicated storage into the player, it does it 6 times and not once, any fix to only do it once?
local debounce = true
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
if debounce then
debounce = false
local particle1 = game.ReplicatedStorage.ParticleEmitter
local particle2 = game.ReplicatedStorage.ParticleEmitter2
local Sound = game.ReplicatedStorage.Sound
local Velocity = game.ReplicatedStorage.BodyVelocity
local death = game.ReplicatedStorage.death
local theCharacter = workspace:WaitForChild(player.Name)
local ragdoll = game.ReplicatedStorage.ragdoll
for i,v in pairs(character:GetChildren()) do
if v:IsA("BasePart") and v.Name ~= "HumanoidRootPart" then
if theCharacter.Humanoid ~= nil then
particle1:Clone().Parent = theCharacter.Torso
particle1:Clone().Parent = theCharacter.Head
particle1:Clone().Parent = theCharacter["Left Arm"]
particle1:Clone().Parent = theCharacter["Right Arm"]
particle1:Clone().Parent = theCharacter["Left Leg"]
particle1:Clone().Parent = theCharacter["Right Leg"]
particle2:Clone().Parent = theCharacter.Torso
particle2:Clone().Parent = theCharacter.Head
particle2:Clone().Parent = theCharacter["Left Arm"]
particle2:Clone().Parent = theCharacter["Right Arm"]
particle2:Clone().Parent = theCharacter["Left Leg"]
particle2:Clone().Parent = theCharacter["Right Leg"]
death:Clone().Parent = theCharacter
Velocity:Clone().Parent = theCharacter.Torso
Velocity:Clone().Parent = theCharacter.Head
Velocity:Clone().Parent = theCharacter["Left Arm"]
Velocity:Clone().Parent = theCharacter["Right Arm"]
Velocity:Clone().Parent = theCharacter["Left Leg"]
Velocity:Clone().Parent = theCharacter["Right Leg"]
ragdoll:Clone().Parent = theCharacter
Sound:Clone().Parent = theCharacter.Torso
wait(4)
debounce = true
end
end
end
end
end)
end)

2 comments
This code needs a lot of work. Wow.
Well I wasn't the one who fixed it (some other user helped fix it)