local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ShopFolders = script.Parent
local objectUIsFolder = ReplicatedStorage.ObjectUis
wait(2)
local function cloneFrames()
for _, folder in (objectUIsFolder:GetChildren()) do
local scrollingFrameShop = ShopFolders:FindFirstChild(folder.Name)
for _, frame in (folder:GetChildren()) do
if frame:IsA("Frame") then
local clonedFrame = frame:Clone()
clonedFrame.SelectBTN.SelectBTN.Text = "Buy"
clonedFrame.Parent = scrollingFrameShop
-- I think it need to be on client, but how I can do it without knowing player, and I cant fire(I think) because it will be fired 100+ times
clonedFrame.SelectBTN.SelectBTN.MouseButton1Click:Connect(function()
local RS = in the player. What I can do?
local CurrectBalance = RS.Value
local CurrectCost = Cost.Value
if CurrectBalance < CurrectCost then return end
RS.Value -= CurrectCost
clonedFrame.SelectBTN.SelectBTN.MouseButton1Click:Connect(function()
local CurrectBalance = RS.Value
local CurrectCost = Cost.Value
if CurrectBalance < CurrectCost then return end
RS.Value -= CurrectCost
local InventoryClonedFrame = frame:Clone()
local InventoryFolders = Player.PlayerGui.Inventory.Folders
InventoryClonedFrame.Parent = InventoryFolders:FindFirstChild(folder.Name)
InventoryClonedFrame.SelectBTN.SelectBTN.MouseButton1Click:Connect(function()
Player.Character.Obj.Value = InventoryClonedFrame
end)
end)
end)
-- I think it need to be on client, but how I can do it without knowing player, and I cant fire(I think) because it will be fired 100+ times
end
end
end
end
cloneFrames()
clonedFrame.SelectBTN.SelectBTN.MouseButton1Click:Connect(function()
local CurrectBalance = RS.Value
local CurrectCost = Cost.Value
if CurrectBalance < CurrectCost then return end
RS.Value -= CurrectCost
clonedFrame.SelectBTN.SelectBTN.MouseButton1Click:Connect(function()
local CurrectBalance = RS.Value
local CurrectCost = Cost.Value
if Cu...
PLEASE don’t make a new connection inside of another one, it will just constantly stack the signals and could destroy the game performance-wise if clicked enough times!
And also, after watching the video, you will see what the script is attached to
And yet, I can’t get rid of these loops due to the fact that if I do, I’ll get rid of the practicality of the code completely. Well, if I do this, there will be more than a thousand lines in the code
CollectionService is made for this. Nesting a connection in a connection can cause memory leaks. Instead, just loop through all of the Instances you need to connect that are tagged.