Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by
Vxpper 101
5 years ago

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

Log in to vote
1
Answered by 5 years ago
Edited 5 years ago

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
0
I'm wanting to clone a GUI frame Vxpper 101 — 5y
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. ForeverBrown 356 — 5y
0
Thank you I will try this right now Vxpper 101 — 5y
0
If i have a UIGridLayout do I still have to edit the Position? Vxpper 101 — 5y
0
if your using a layout then you do not have to mess with size/position ForeverBrown 356 — 5y
Ad

Answer this question