Learning as I build my game. Don't really know the reason why this doesn't work. Can someone help me figure out the issue?
So basically I made it so when a player owns the gamepassId it makes "ClearSongs" visible. However it isn't making the frame visible. Why's that?
local plr = game.Players.LocalPlayer local marketplace = game:GetService("MarketplaceService") local gamepassId = 9016487 local ClearSong = game.StarterGui.MainGui.Shop.ShopOpener.ScrollingFrame.ClearSongs game.Players.PlayerAdded:Connect(function(plr) if marketplace:UserOwnsGamePassAsync(plr.UserId, gamepassId) then print("User owns victory songs") ClearSong.Visible = true end end)
You are making it so the frame is visible to the StarterGui
but not the PlayerGui
. At the start of the game, everything in 'StarterGui' is cloned into 'PlayerGui' which is stored inside of the player on spawn.
To fix this, you just need to simply change the local variable you made.
Your version:
local ClearSong = game.StarterGui.MainGui.Shop.ShopOpener.ScrollingFrame.ClearSongs
Corrected Version:
local ClearSong = plr:WaitForChild("PlayerGui").MainGui.Shop.ShopOpener.ScrollingFrame.ClearSongs
(The code went a bit over line, just imagine it was 1 line.)
I hope this helps!