I read through the Roblox Developer Hub on how to make a ProximityPrompt work, and I can get it to do certain things, but I want to be able to open in game gui stores with one. I can't find how to call into the Frame to make it visible, and I can't find how to get the Frame to look for the correct trigger.
Below is what I added to the Frame localScript
local prompt = game:GetService("ProximityPromptService")
local button = game.Workspace.MinerStore.ProximityPrompt.Triggered:WaitForChild()
local function prompt(PromptObject, player)
frame.Visible = not frame.Visible
And then this is what my Prompt script shows.
local frame = game.StarterGui.Miners:WaitForChild("Frame")
game.Workspace.MinerStore.ProximityPrompt.Triggered:Connect(function(player)
--game.StarterGui.Miners.Frame:Connect(function(player)
-- frame.Visible = not frame.Visible
--end)
end)
I took all of this right from the developer hub and tried to make it my own, but for reasons I don't understand the two don't connect.
Your commented out code shows that you are making a common mistake. UI that is placed in the StarterGui acts as a template. It is copied into each player's PlayerGui when their character spawns. You appear to be trying to modify the UI template, not the actual UI that the specific player sees.
Since a ProximityPrompt can be observed in a LocalScript, you can directly listen for the trigger in the UI LocalScript.
local prompt = game.Workspace.MinerStore.ProximityPrompt
local frame = script.Parent
prompt.Triggered:Connect(function()
frame.Visible = true
end)