I've been trying to solve this issue for many hours but I cannot seem to find a working solution. I have a script of a part (script.Parent) that when stepped on, would run a command that clones a part in ServerStorage with its own script. The problem is that when you step on the part it makes infinant clones which is an issue as it lags badly.
Code for Part:
local part = script.Parent local playedAlready = nil part.Touched:connect(function() if not playedAlready then -- Clones the part into Worksoace. local lavaWall = game.ServerStorage.MyFolder.LavaWall local clonedPart = lavaWall:Clone() wait(1) clonedPart.Parent = workspace.Levels11thru20 clonedPart.Position = Vector3.new(-11.5, 78, 800.5) if not clonedPart.Anchored then clonedPart.Anchored = not clonedPart.Anchored -- Sets to the opposite, personal pref. end playedAlready = true end end)