I'm creating a shop where a pre-made button will appear for a player when they buy an item. My intention is to make the button invisible at first, and when the player buys an item, it becomes visible. I got this to work, however I want the button to stay visible when the player dies. I used a CharacterAdded function to go directly into the player's StarterGui and make the button visible. This works outside of the CharacterAdded function, but not inside of it, as I mention in the comments below. I also tried making a remote event that triggers a localscript inside of the button to make the button visible, but still no luck (I don't get any errors, compiler just skips over these lines of code.) Does anyone know why this happens, and what I can do differently to make the code inside the function work?
if Player.Inventory:FindFirstChild("Bool") then Player.PlayerGui.ScreenGui.Button.Visible = true --this works print("-Button loaded-") --this prints
Player.CharacterAdded:Connect(function()
Player.PlayerGui.ScreenGui.Button.Visible = true --this does NOT work
game.ReplicatedStorage.GETButton:FireClient(Player) --this does NOT work
print("-Player Respawned. Button returned-") --this prints
end)
end
