Activated or MouseButtonDown Event running 3 times in one game only

Hi,

I have one very very big problem I dont know if thats a roblox bug or I am just stupid but an Activated or MouseButtonDown Event runs 3 times for some reason This only happens in 1 game.I just don´t know why but I am so upset with it right know
Sorry for bad grammar or if the problem isnt clear at all

Thanks for any help

1 Like

If your create an event using :Connect(), it will create that event, however it will not account for the same events that already exists, so you will end up having multiple of these events firing at one time, due them all listening to the same thing.

Ok but my script works like a charm on one game but not on the other game.Do you know why it happens?

Uhh you could show the script or add more details what exactly want? If you want a button to be clicked only once you can use Button.Activated – Or what ever there is :ConnectOnce() – If thats what you need…

Local Script:

Mouse.Button1Down:Connect(function()
    if Equipped and mouseTarget.Parent == PartsFolder or Equipped and mouseTarget.Parent == TransparentParts or Equipped == true and mouseTarget.Parent == PartsFolderPRE  then 
         PlaceBlock:FireServer(PreviewCFrame,mouseTarget,Block,PartsFolder,TransparentBlock,TransparentParts,PartsPreview,Mouse.TargetSurface)
    end
end)

Server script:

PlaceBlock.OnServerEvent:Connect(function(player,PreviewCFrame,mouseTarget,Block,PartsFolder,TransparentBlock,TransparentParts,PartsPreview,MouseTargetSurface)
    local Clone = Block:Clone()
    Clone.Parent = PartsFolder
    Clone.CFrame = PreviewCFrame
    --Clone.CFrame = TransparentBlock.CFrame
   local FakeBlock1 = TransparentBlock:Clone()
   local FakeBlock2 = TransparentBlock:Clone()
   local FakeBlock3 = TransparentBlock:Clone()
   local FakeBlock4 = TransparentBlock:Clone()
   FakeBlock1.Parent = TransparentParts
    FakeBlock2.Parent = TransparentParts
    FakeBlock3.Parent = TransparentParts
    FakeBlock4.Parent = TransparentParts
    if mouseTarget.Parent == PartsFolder or mouseTarget.Parent == workspace.PartsFolderPRE or mouseTarget.Parent == TransparentParts then
        FakeBlock1.Position =  Clone.Position + Vector3.new(3,0,0)
        FakeBlock1.Weld.Part1 = Clone
        FakeBlock2.Position =  Clone.Position + Vector3.new(-3,0,0)
        FakeBlock2.Weld.Part1 = Clone
        FakeBlock3.Position =  Clone.Position + Vector3.new(0,0,-3)
        FakeBlock3.Weld.Part1 = Clone
        FakeBlock4.Position =  Clone.Position + Vector3.new(0,0,3)
        FakeBlock4.Weld.Part1 = Clone
    end
    if mouseTarget.Name == "Block-Transparent" then
       Clone.Parent = PartsFolder
       Clone.Position = mouseTarget.Position + Vector3.new(0,0,0)
        mouseTarget:Destroy()
        mouseTarget:Destroy()
        mouseTarget:Destroy()
        mouseTarget:Destroy()
    end
end)

Both of these events fires 3 times in one game but in other game it only runs 1 time

1 Like

I don’t think it Fires 3 times.

If it would fire 3 times then it would be like this?

Mouse.Button1Down:Connect(function()
    if Equipped and mouseTarget.Parent == PartsFolder or Equipped and mouseTarget.Parent == TransparentParts or Equipped == true and mouseTarget.Parent == PartsFolderPRE  then 
         
 
 PlaceBlock:FireServer(PreviewCFrame,mouseTarget,Block,PartsFolder,TransparentBlock,TransparentParts,PartsPreview,Mouse.TargetSurface)
 PlaceBlock:FireServer(PreviewCFrame,mouseTarget,Block,PartsFolder,TransparentBlock,TransparentParts,PartsPreview,Mouse.TargetSurface)
 PlaceBlock:FireServer(PreviewCFrame,mouseTarget,Block,PartsFolder,TransparentBlock,TransparentParts,PartsPreview,Mouse.TargetSurface)
    end
end)

Why don’t you uhhh add a debounce?

debounce or any other things dont work

no,the mouse clicked fires 3 times so the Server side runs three times aswell

I am pretty sure that thaths a roblox bug becuase it works on my game but not on the other

What do you exactly mean by “it works on my game but not on the other”?

It works on my private game but not on any other one

Well I don’t think I can help. Only way could I think of is re-making the system or something.

Oh and also how do I get Programmer or a Scripter Badge on roblox devforum?

Well you aren’t really a programmer if you can’t fix this issue. jk. You can find it in settings.

1 Like