I’m currently attempting to make a tips UI system that duplicates a frame inside the script to another frame in the GUI. It seems simple enough, however after much debugging I still cannot figure out why the frame will not clone to another part of the GUI. The “template” frame is parented under the localscript in the GUI. All of the RemoteEvents work, with the exception of the tips frame not being cloned. I checked in Studio under PlayerGui and confirmed that it was not being cloned.
-- vars
local uiFrame = script.Parent.UIFrame
local button = script.Parent.ImageButton
local close = script.Parent.UIFrame.Close
local gamepassFrame = uiFrame.CurrentGamepasses
local addGamepassFrame = uiFrame.AddGamepass
local Player: Player = game.Players.LocalPlayer
-- {0.522, 0},{0.644, 0}
local function openFrame()
uiFrame.Visible = true
uiFrame:TweenSize(UDim2.fromScale(0.522, 0.644), Enum.EasingDirection.InOut, Enum.EasingStyle.Quart, 0.5)
end
local function closeFrame()
uiFrame:TweenSize(UDim2.fromScale(0,0), Enum.EasingDirection.InOut, Enum.EasingStyle.Quart, 0.5)
end
button.MouseButton1Click:Connect(function()
openFrame()
end)
close.MouseButton1Click:Connect(function()
closeFrame()
end)
-- disable ui if not a high enough rank
uiFrame.Visible = false
-- Create gamepass
function tweenGamepassFrame ()
gamepassFrame:TweenPosition(UDim2.fromScale(1.5, 0.6), Enum.EasingDirection.InOut, Enum.EasingStyle.Quart, 0.5)
addGamepassFrame:TweenPosition(UDim2.fromScale(0.5, 0.6), Enum.EasingDirection.InOut, Enum.EasingStyle.Quart, 0.5)
end
addGamepassFrame.TextButton.MouseButton1Click:Connect(function()
gamepassFrame:TweenPosition(UDim2.fromScale(0.5, 0.6), Enum.EasingDirection.InOut, Enum.EasingStyle.Quart, 0.5)
addGamepassFrame:TweenPosition(UDim2.fromScale(-1.5, 0.6), Enum.EasingDirection.InOut, Enum.EasingStyle.Quart, 0.5)
game.ReplicatedStorage.TipSysRemotes.addGamepass:FireServer(tonumber(addGamepassFrame.TextBox.Text))
for _, v in pairs(gamepassFrame:GetChildren()) do
v:Destroy()
end
local gamepasses = game.ReplicatedStorage.TipSysRemotes.getGamepasses:InvokeServer()
for _, v in pairs(gamepasses) do
local template = script.Frame:Clone()
template.ImageLabel.Image = "rbxassetid://"..v["gamepassMeta"]["IconImageAssetId"]
template.Parent = gamepassFrame
template.TextButton.MouseButton1Click:Connect(function()
game.ReplicatedStorage.TipSysRemotes.removeGamepass:FireServer(v["TargetId"])
template:Remove()
end)
end
end)
script.Parent.UIFrame.AddGamepassButton.MouseButton1Click:Connect(function()
tweenGamepassFrame()
end)
-- Get gamepasses
local gamepasses = game.ReplicatedStorage.TipSysRemotes.getGamepasses:InvokeServer()
for _, v in pairs(gamepasses) do
local template = script.Frame:Clone()
template.ImageLabel.Image = "rbxassetid://"..v["gamepassMeta"]["IconImageAssetId"]
template.Parent = gamepassFrame
template.TextButton.MouseButton1Click:Connect(function()
game.ReplicatedStorage.TipSysRemotes.removeGamepass:FireServer(v["TargetId"])
template:Remove()
end)
end
local groupID = 32812458
local rankID = 237
if Player:GetRankInGroup(groupID) < rankID then
script.Parent.Enabled = false
end
