Put Custom GUI on Screen while using ProximityPrompt

Back again! I am trying to get my custom GUI to show up on screen when triggered by the ProximityPrompt. I have 2 scripts:

Handler:

-- Variables
local HuntScreen = game.ReplicatedStorage.HuntScreen
local Screen = script.Parent.Parent.ScreenGui.ImageLabel

local ViewTime = 70

-- Mains
HuntScreen.OnClientEvent:Connect(function() -- When Client fires, this will response
	for i = 1,10 do
		Screen.ImageTransparency -= 0.1
		wait(0.01) -- 0.01 more faster fade or 0.1 slow fade
	end
	wait(ViewTime)
	for i = 1,10 do
		Screen.ImageTransparency += 0.1
		wait(0.01)
	end
end) -- End

Then the executer I had this so far (This is inside of the ProximityPrompt):

script.Parent.Triggered:Connect(function(screen) 
	
end)

I think I need to trigger the RemoteEvent I have created to trigger in here?

I think I have made my script very complicated though. If anyone could simplify it and help me make it work you’d be much appreciated.

Thanks! :smile: :upside_down_face:

1- The parameter ’ screen’ is not the UI, but the Player who triggered the prompt.

2-You can use a remote, but I don’t think it’s necessary here,
instead - you could clone the UI into that player from the server, and do the stuff too.

I can put the UI anywhere. Could we just start from the beginning with a new script?

local proxPrompt = workspace.ProximityPrompt
proxPrompt.Triggered:Connect(function()
ScreenGUI.ImageTransparency -=0.1
end)

Would that work??

script.Parent.Triggered:Connect(function(Player) 
	local UI = script.Parent["YOUR_GUINAME"]:Clone()
    UI.Parent = Player:WaitForChild("PlayerGui")
    --Get access to the frame/button here
end)
1 Like

No, this would not work, because ‘ScreenGUI’ isn’t recognized here.

1 Like

And is this a ServerScript inside of the ProximityPrompt?

Yes. Make sure the UI [ScreenGui] is located in that Proximity.

1 Like

OKay! If I created an x button in the corner to close the menu, could you make a script for that please?

Or after a certain amount of time it closes?

You could do this :

script.Parent.Triggered:Connect(function(Player) 
	local UI = script.Parent["YOUR_GUINAME"]:Clone()
    UI.Parent = Player:WaitForChild("PlayerGui")
    --Get access to the frame/button here
    task.wait(1) -- change 1 to whatever you want
    UI:Destroy() --destroys the UI
end)
1 Like

When cloning, does it set it to clone at the position where I had it before? I also have the ImageTransparency = 1. Should I change this?

The UI’s clone would put it automatically at the same position it looked on StarterGui.

I don’t have the UI placed into StarterGUI folder. I have it placed inside the ProximityPrompt. Do I need to change this?

There is also and ImageLabel inside of the ScreenGUI. Is this okay with your script or do I need ["ScreenGUI"].ImageLabel:Clone()

It works perfectly. Lifesaver, thanks!