Code not turning UI On

(Normal script) So this code inside of a proximity prompt enables A UI and a localscript inside the UI

local ProxP = script.Parent

local PhotoSetModule = require(game:GetService(“ReplicatedStorage”).PhotoSets)

ProxP.Triggered:Connect(function(plr)
print(“ran”)
local ui = plr.PlayerGui:FindFirstChild(“Photosets”)
ui.Enabled = true
ui.photosetHandler.Enabled = true
print(“foundhandler”)

PhotoSetModule.NewSet(ui.PhotosetStart.ImageLabel, ui.PhotosetBack.ImageLabel, "1")
print("photomade")

end)

(Code block not working for some reason)

but if the player closes the ui and disables the script with:

game.Players.LocalPlayer.PlayerGui.Photosets.Enabled = false
game.Players.LocalPlayer.PlayerGui.Photosets.photosetHandler.Enabled = false

it closes but if the players runs the proximity prompt again it doesnt open or enable it