Hello, my issue is that the for loop in my script clones multiple times the textbutton. I want it to only loop to avoid an infinite amount of textbutton being cloned.
-- Extract of the script.
if plr:DistanceFromCharacter(Mouse.Target.Position) < maxDistance then
local tPlayer = game:GetService("Players"):GetPlayerFromCharacter(Mouse.Target.Parent)
if tPlayer then
if tPlayer.Team ~= RedactedTeam then
local toolschildrens = tPlayer.Backpack:GetChildren()
for i, v in pairs(toolschildrens) do
if v:IsA("Tool") then
local frame = TextButton:Clone()
frame.Parent = ItemsFrame
frame.Text = v.Name
end
end
end
end
end