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
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.
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…
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
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)