PROBLEM SOLVED
Here is my code:
script.Parent.DescendantAdded:Connect(function()
for k, n in pairs(script.Parent:GetChildren()) do
if n.Name == "Tile" then
local building = n.Build:FindFirstChild("Block")
if building then
building.clickd.MouseClick:Connect(function(player)
if player.Sbuilding.Value == "Delete" then
print("object deleted!")
building:Remove()
end
end)
end
end
end
end)
As expected, I can delete objects when I click on them and my sbuilding is "Delete". The weird this is, in the output, is prints "object deleted!" a lot of times! sometimes it prints it a few dozen times, sometimes a few hundred, and sometimes over 10,000! Does anyone have any idea why?
I also have a similar script, with the same problem.
script.Parent.DescendantAdded:Connect(function()
for k, n in pairs(script.Parent:GetChildren()) do
if n.Name == "Tile" then
local building = n.Build:FindFirstChild("Block")
if building then
building.clickd.MouseClick:Connect(function(player)
if player.Sbuilding.Value == "Rotate" then
print("a thingimabob has been rotated!")
building:SetPrimaryPartCFrame(building.PrimaryPart.CFrame * CFrame.Angles(0, math.rad(90), 0))
end
end)
end
end
end
end)
Any help would be appreciated, thanks!

1 comment
Okkkk, im an idiot. So, the reason this is happening is that these click events are stacking up, because the old events are not getting deleted.