Hi! I was attempting to make a little feature when a Proximity Prompt is triggered, a GUI pops up. I put a local script in the part w/ the proximity prompt (I know it’s unsafe) in order to get to a frame within a ScreenGui. Here it is.
local startGUI = game:GetService("StarterGui")
local Page = startGUI["Maps/Details"].DesertDebrief.Page
local ProxPrompt = script.Parent.ProximityPrompt
local function showPage()
Page.Visible = true
print("page shown")
end
ProxPrompt.Triggered:Connect(function()
showPage()
end)
I know it’s somewhat primitive but I don’t have much of a clue on where to start out with. If anyone could give some pointers I’d be pretty grateful.
I’m not very advanced scripting-wise so thank you for your patience!
It isn’t unsafe really because a local script will not run if it is under workspace. You can test this by just putting a default local script in a part and running it…you won’t see it print Hello, World! in the output window. You will need to have a script in the part that when triggered by the proximity prompt it fires an event to the client where you display your frame.
You cannot use a localscript under a part in workspace. Use a script, and also a gui will not show up if you’re manipulating it from startergui, each player has the startergui copied and pasted under their own category, you have to get the gui from playergui.
Because it’s a local script it won’t work, and there’s so much more easier ways to do it.
Use a server script and try this instead:
ProxPrompt.Triggered:Connect(function(Player)
game.Players:FindFirstChild(Player.Name).PlayerGui --- wutever the gui's parent or child you are looking for
end)
no need to fire an event, just make it into a normal script which has its runcontext set to client. it still runs only on client but also works everywhere but serverstorage or serverscriptstorage since those are server only.