Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

When a value is true, clone a gui why does this not work?

The values are becoming true but the frame just is not

--<< Variables >>--
local plr = game.Players.LocalPlayer
local bool = plr.ShopItems.Knives

--<< Frames >>--
local bg = script.Parent
local knifeinv = bg.Knives
local revinv = bg.Revolver
local abilinv = bg.Abilities
local petinv = bg.Pets
local radioinv = bg.Radios
local newknife = knifeinv.Template

while wait(1) do -- start of loop

if bool.Common.Value == true then
	newknife:Clone()
	newknife.Visible = true
	newknife.Name = "KnifeA"
	newknife.Rarity.ImageColor3 = Color3.fromRGB(43,125,43)
	newknife.Item.Text = "Starter"
end

if bool.Uncommon.Value == true then
	newknife:Clone()
	newknife.Visible = true
	newknife.Name = "KnifeB"
	newknife.Rarity.ImageColor3 = Color3.fromRGB(43,125,43)
	newknife.Item.Text = "Skies"
end

end -- End of Loop

I have a UIGridLayout in this GUI that if cloned, it moves the "newknife" but it does not clone the GUI. There are no errors in console

1 answer

✓ Accepted answer

If you are wanting to clone something and change the properties of the cloned item then...

local part = workspace.Part

local newPart = part:Clone()
newPart.Size = Vector3.New(2,2,2)
newPart.Anchored = true
newPart.Parent = workspace

GUI

local frame = script.Parent

local newFrame = frame:Clone()
newFrame.Size = UDim2.new(.2,0,.2,0)
newFrame.Position = UDim2.new(.5,0,.5,0)
newFrame.AnchorPoint = Vector2.new(.5,.5)
newFrame.Parent = script.Parent.Parent

5 comments

0

I'm wanting to clone a GUI frame

0

Its the same process. I was just showing how to do it. I'll update the answer to show the properties of gui elements.

0

Thank you I will try this right now

0

If i have a UIGridLayout do I still have to edit the Position?

0

if your using a layout then you do not have to mess with size/position

This discussion is preserved as it was. New answers, comments, and votes are closed.