Log in to vote

Explosion cloning itself twice?

Asked by 16 days ago

i have this ability that I've been working on, when used its used an explosion is cloned at the torso of the enemy you are targeting. The problem is, the explosion appears twice, only one of these explosions actually does damage, but 2 explosions coming out is unideal

if val2:find("Detonation") then
                                    local u3 = require(game.ServerScriptService.Modules.HitDetection);
                                    local v16 = game.ServerStorage.Assets.CannonExplosion:Clone();
                                    v16.CFrame = enemy.Torso.CFrame
                                    v16.Anchored = true
                                    v16.Owner.Value = Player.Name
                                    v16.Parent = game.Workspace.Thrown;
                                    v16.Impact.fart.Enabled = true
                                    v16.Impact.nerd.Enabled = true
                                    v16.Impact.L.Enabled = true
                                    v16.Impact.ez.Enabled = true
                                    v16.Impact.trash.Enabled = true
                                    v16.Impact.doodoo.Enabled = true
                                    v16.Impact.jaja.Enabled = true
                                    v16.Impact.hi.Enabled = true
                                    v16.Impact.fart.Enabled = false
                                    v16.Impact.nerd.Enabled = false
                                    v16.Impact.L.Enabled = false
                                    v16.Impact.ez.Enabled = false
                                    v16.Impact.trash.Enabled = false
                                    v16.Impact.doodoo.Enabled = false
                                    v16.Impact.jaja.Enabled = false
                                    v16.Impact.hi.Enabled = false
                                    if character.Name == v16.Owner.Value then
                                    if info.damage and math.random(1,1)<=1+(info.damage*0.2) and not character:FindFirstChild("DetoCD") then
                                        u3.magnitudeCheck(character, v16.Position, 30, {
                                            mana = true, 
                                            damage = 15,
                                            nostun = true,
                                            --ignoreragdoll = true,
                                            --executes = true, 
                                        }, false, true);
                                    --  game.Debris:AddItem(v16, 3)
                                        local v17 ="Accessory")
                                        v17.Name = "DetoCD"
                                        v17.Parent = character
                                        game.Debris:AddItem(v17, 3)

I think the local v16 is causing a second one to come out, but when I remove the ":Clone()" the explosion comes out once and then gets taken out of storage forever, causing no more explosions to come out. Is there a way to make it not clone without taking the explosion out of serverstorage?

1 answer

Log in to vote
Answered by 15 days ago

The script here seems fine, it may have something to do with one of the modules that you are using, or maybe another script that you have that also clones it. Theres also the possibility of you running the code more than once but from what i see here, this part wouldn't be the issue. Also don't remove clone() as it would be required for you to use the ability multiple times and its not related to the problem here.

The one being cloned here would be the one that deals the damage, as it seems to be hooked up to the hitbox module, you would have to look through your other scripts or maybe another part of this script that you didn't send where you have cloned the "CannonExplosion"

I found the solution and fixed the problem, thanks for your help. Uniplier 29 — 15d

Answer this question