So I’m trying to make it so a GUI opens from a Proximity prompt, however I’ve tried so many different scripts, it seems essentially impossible.
I've tried using a script (similar) to this which would run on the serverside which would give the error: "Player Arguement must be a Player Object"
PopupFolder = game.ReplicatedStorage.Popups
script.Parent.ProximityPrompt.Triggered:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid")then
PopupFolder.Sawmill.Leave2:FireClient(game.Players:GetPlayerFromCharacter(hit.Parent))
end
end)
I then tried using a local script in which a breakpoint at the beginning wouldn't even trigger:
Proximity prompts are handled on the server whereas player guis are handled on the client. You need to make a remote event that is fired to the client when a proximity prompt is triggered. see here for proximity prompt events: ProximityPrompt (roblox.com) and here for handling remote events: Remote Functions and Events (roblox.com)
To make a gui appear after a proximity prompt is triggered you will need a script, local script, and a remote event. I quickly made a demo project which I have attached. Simply put, when you trigger the proximity prompt the server script triggers the remote event, which then triggers the local script to make the gui visible.
The simplest way to achieve this is to have a “ScreenGui” instance be cloned into the player’s “PlayerGui” folder when that particular player triggers a prompt.
local Prompt = script.Parent
local Server = game:GetService("ServerStorage")
local Gui = Server.ScreenGui
Prompt.Triggered:Connect(function(Player)
local GuiClone = Gui:Clone()
GuiClone.Parent = Player.PlayerGui
end)