Im trying to create a Shop gui but when I clone a button and put it in the frame its not clickable, im wondering if theres any sanity checks I have to do or something just with the game.? The premade buttons work fine if they are already inside the frame before the game starts.
ServerScript:
function onPlayerAdded(plr)
local playerGui = plr:WaitForChild('PlayerGui')
for i,skin in pairs(Products.Skins) do
local skinName = skin.name
local skinDesc = skin.description
local skinId = skin.id
local success,ownsProduct = pcall(function()
return MarketPlaceService:PlayerOwnsAsset(plr, skinId)
end)
if success then
if ownsProduct then
print("owns product")
else
print(plr.Name.." does not own "..skinName)
local skinTemp = playerGui.ScreenGui.Tab.TabClient.Skin:Clone()
skinTemp.Name = skinName
skinTemp.Description.Value = skinDesc
skinTemp.Parent = playerGui.ScreenGui.Tab.SkinsFrame
end
else
warn("Error checking asset ownership for "..plr.Name..", asset "..skinId.." "..skinName..": "..tostring(ownsProduct))
end
end
end
LocalScript:
for i,button in pairs(script.Parent.SkinsFrame:GetChildren()) do
if button and button:IsA("ImageButton") then
button.MouseButton1Click:Connect(function()
if button.Name==SkinsFrame2.SkinName.Text then return end
local SkinName = button.Name
local Description = button.Description.Value
local Thumbnail = button.Image
SkinsFrame2.SkinName.Text = SkinName
SkinsFrame2.Description.Text = tostring(Description)
SkinsFrame2.Thumbnail.Image = Thumbnail
print(SkinName)
SkinsFrame2.WearButton.MouseButton1Click:Connect(function()
if SkinsFrame2.SkinName.Text == "Skin" then return end
if SkinsFolder:FindFirstChild(SkinName) then
ServerRemote:FireServer("WearSkin",SkinName)
else
return warn("Skin is not in Skins Folder")
end
end)
end)
end
end