Hello developers, so I have been working on this code to open a frame in StarterGUI, and when I use the ProximityPrompt in the game, it will print my name, but the GUI I want to show up is not showing up? If anybody would help, I would really appreciate it. The code and all the details you need to know is Just below:
Code:
The problem is that you’re changing a GUI in StarterGui, not the playerGui.
local ProximityPrompt1 = script.Parent.ProximityPrompt
local UI = game.StarterGui.PCUI.UI.UIDesign.MainFrame
ProximityPrompt1.Triggered:Connect(function(player)
print(player.Name)
UI.Visible = true
end)
Whenever the game launches, the items in StarterGui get added to the Player under a folder called PlayerGui. Therefore, you should get the player and then get the Gui from their PlayerGui folder.
local ProximityPrompt1:ProximityPrompt? = script.Parent.ProximityPrompt
ProximityPrompt1.TriggerEnded:Connect(function(player)
print(player.Name)
player.PlayerGui.PCUI.UI.UIDesign.MainFrame.Visible = true
end)