Hello! I am here! to ask for help. I am open to every idea as long as it makes sense
I know it sounds rude asking for help and saying as long as it makes sense but I am neither native english speaker nor I am good at english. so I don’t really know how to make a better speech
if it sound rude. sorry. I didn’t mean to be rude
here is the problem:
-
What do you want to achieve? Keep it simple and clear!
I am trying to refresh gui after “purchase” event simply Deletes the Button and re-creates them (removes the next Item’s l"ock"Image) but refreshing part is kinda “Ugly”
Check the video to understand what I mean with ugly
It hurts eyes and kinda disturbing right?
so. I am trying to refresh gui without that Deleting and re-creating part but I can’t figure out how to do it
2. What is the issue? Include screenshots / videos if possible!
(Both are in same module script. just wanted to make things easier for readers)
local ShopGuiThing = script.Parent
local ServerStorage = game:GetService("ServerStorage")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local remotes = ReplicatedStorage:FindFirstChild("Remotes")
local players = game:GetService("Players")
local ScriptYapilabilirobjeler = game:GetService("Workspace"):WaitForChild("SccriptYapılabilirObjeler"):FindFirstChild("MagazaAcar")
local player = players.LocalPlayer
local TweenService = game:GetService("TweenService")
local toolConfig = require(ReplicatedStorage:WaitForChild("ToolConfig")) -- !!!!!!!!!!!!!!!!!
local DNAConfig = require(ReplicatedStorage:WaitForChild("DNAConfig")) -- !!!!!!!!!!!!!!!
local RankConfig = require(ReplicatedStorage:WaitForChild("RankConfig"))-- !!!!!!!!!!!!!!!!!!!!
local ToolModels = ReplicatedStorage:WaitForChild("ToolModels")
local formatNumber = require(ReplicatedStorage:WaitForChild("LİBBOS"):WaitForChild("FormatNumber"))
local Frame = ShopGuiThing.Frame
local Container =Frame.ShopMain.ScrollingContainer
local ItemTemplate = script.Template
local InfoFrame= Frame.ShopMain:WaitForChild("InfoFrame")
local InfoViewportFrame = InfoFrame:WaitForChild("ViewportFrame")
local InfoBuyButton = InfoFrame.ItemBuyButton
local InfoItemName = InfoFrame.ItemName
local InfoStrengthFrame = InfoFrame.ItemStrength
local InfoItemPrice = InfoFrame.ItemPrice
local InfoImageLabel = InfoFrame.ImageLabel
local BuyAllButton = InfoFrame.BuyAllButton
local UyariKutucusuSatinAlma = script.Parent.Warning
local ClickedItem
local CurrentShop
local scytheLevel = 0
local Shop = {}
Shop.__index = Shop
CurrentShop = true
local function clearContainer()
for _, child in ipairs(Container:GetChildren()) do
if child:IsA("TextButton") then
child:Destroy()
end
end
end
function Shop.Buy()
-- ask server if player has enought money to buy items
local ehe = remotes.ShopFireThingoBuyo:InvokeServer(ClickedItem.Name, CurrentShop)
if ehe == "NotEnoughtMoney" then
print("NotEnoughtMoney")
elseif ehe == "Equipped" or ehe == "Purchase" then
-- if has money then refresh gui and then change buttons
Shop.new(CurrentShop)
InfoBuyButton.BackgroundColor3 = Color3.fromRGB(77, 68, 198)
InfoBuyButton.Text = "Equipped"
else
InfoBuyButton.BackgroundColor3 = Color3.fromRGB(0, 255,255)
InfoBuyButton.Text = "Buy"
end
if CurrentShop == "Conkey" then
InfoViewportFrame.Visible= true
InfoImageLabel.Visible = false
else
InfoViewportFrame.Visible = false
InfoImageLabel.Visible = true
end
end
function Shop.new(shop: string)
clearContainer()
BuyAllButton.Visible = true
CurrentShop = shop
print("Tanratointiano")
ShowInfoFrame(false)
local list = if shop == "Scythe" then toolConfig elseif shop =="DNA" then DNAConfig else RankConfig
local eheh1 =remotes.ShowScythes:InvokeServer(shop)
for _, toolTable in ipairs(list) do
print(list)
local object = setmetatable({}, Shop)
print(object)
object.Name = toolTable.ID
object.Stat = if toolTable.Stat then toolTable.Stat else 0
object.Price = toolTable.Price
object.ImageId = if toolTable.ImageId then toolTable.ImageId else nil
object.Visible = if toolTable.Visible then toolTable.Visible else nil
object.Level = if toolTable.Level then toolTable.Level else nil
print(object)
local ItemClone = ItemTemplate:Clone()
ItemClone.Parent = Container
ItemClone.LayoutOrder = toolTable.order
local ImageLabel = ItemClone.ImageLabel
ImageLabel.Image = toolTable.ImageId
local Image = ImageLabel.Image
Image = toolTable.ImageId
object.TemplateButton = ItemClone
if object.Level > eheh1 +1 then
object.TemplateButton.Lock.Visible = true
object.TemplateButton.ImageLabel.Visible = false
else
object.TemplateButton.Lock.Visible = false
object.TemplateButton.ImageLabel.Visible = true
end
object.TemplateButton.MouseButton1Click:Connect(function()
object:Click(eheh1)
end)
end
end
now just to clarify a few things: That “Ugly” thing happens because of "clearContainer()
But removing that part
turns Gui to this which is uglier than before
and it happens because of this part
local ItemClone = ItemTemplate:Clone()
ItemClone.Parent = Container
But I can’t remove this part because if I do. this part won’t work
object.TemplateButton = ItemClone
if object.Level > eheh1 +1 then
object.TemplateButton.Lock.Visible = true
object.TemplateButton.ImageLabel.Visible = false
else
object.TemplateButton.Lock.Visible = false
object.TemplateButton.ImageLabel.Visible = true
end
object.TemplateButton.MouseButton1Click:Connect(function()
object:Click(eheh1)
so. I am open to every idea