I’m trying to create a tool in my game that drops explosive piano’s but I’m currently facing a problem were for some reason if the piano touches another piano, then the
Connection:Disconnect() function won’t run until the piano that touched another touches something else.
Here’s the script, I can provide a video if needed.
local Connection ActivateBombRemote.OnServerEvent:Connect(function(user, pianoDropCFrame) -- This is the function that makes the bomb go off, which connects the ActivateBomb Remote Event to this script after it gets activated by the local script. local bombClone = tool.Piano:Clone() bombClone.Parent = game.Workspace bombClone.CanCollide = true bombClone.CFrame = pianoDropCFrame * CFrame.new(0, 100, 0) bombClone.Anchored = false bombClone.Transparency = 0 Connection = bombClone.Touched:Connect(function(hit) local Player = game:GetService("Players"):GetPlayerFromCharacter(hit.Parent) if Player and Player.Team ~= user.Team then Connection:Disconnect() print(hit) hit.Parent:FindFirstChildOfClass("Humanoid"):TakeDamage(35) explode(bombClone, user) elseif not Player then Connection:Disconnect() print(hit) explode(bombClone, user) end end) end)