I’m Writing a code to try and open a Gui after pressing E and it doesn’t work this is my code:
local SolarFrame = script.Parent.SolarFrame
local PPS = game:GetService(“ProximityPromptService”)
PPS.PromptTriggered:Connect(function(prompt,player)
>if prompt.Name == "OpenGuiPrompt" then
>SolarFrame.Visible = true
>end
end)
SolarFrame is an image
3 Likes
why did u put prompt and player in pps.prompttriggered:Connect(function(prompt,player)
Valkyrop
(aHuman)
5
You dont need to put prompt and player as params in the event.
1 Like
why did u use proximity prompt service when u can just use create instance or just insert a proximity inside whatever your trying to do and then do
script.Parent.Triggered:Connect(function()
if script.Parent.Name == "OpenGuiPrompt" then
--so on
end
1 Like
Like this
local SolarFrame = script.Parent.SolarFrame
local PPS = game:GetService(“ProximityPromptService”)
>script.Parent.Triggered:Connect(function()
if script.Parent.Name == "OpenGuiPrompt" then
>SolarFrame.Visible = true
>end
end)
2 Likes
is it a part or smth that has a proximitypart? like e to open the barrier
It is a part with attachment then proximity
1 Like
can you show me a pic of the part
also is the part in workspace or in a model?
In the workspace here is the part
2 Likes
do you want the gui toggable or have a x button to close it off
It has a X button to close so just how it is
2 Likes
here
local partguithingy = game.Workspace.partguithingy
local proximity = partguithingy:WaitForChild("ProximityPrompt")
local gui = script.Parent.Parent
local closebutton = script.Parent.Parent.closebutton
gui.Visible = false
proximity.Triggered:Connect(function()
gui.Visible = true
end)
closebutton.MouseButton1Click:Connect(function()
gui.Visible = false
end)
this what mines look like
if that didnt work tell me
2 Likes
this didnt work I named the thing to the correct thing and nothing
2 Likes
can u show pic of the gui
1 Like
nooo the partguithingy suppose to be the part with the proximity prompt inside it
1 Like
I even named the part with the name and it didn’t work
1 Like
local partguithingy = game.Workspace.partguithingy
local proximity = partguithingy:WaitForChild("ProximityPrompt")
local gui = script.Parent.Parent
local closebutton = script.Parent.Parent.closebutton
gui.Visible = false
proximity.Triggered:Connect(function()
proximity.Name = "OpenGuiPrompt"
if proximity.Name == "OpenGuiPrompt" then
gui.Visible = true
end
end)
closebutton.MouseButton1Click:Connect(function()
gui.Visible = false
end)
The output says nothing and i named the part where the proximity prompt is and it don’t work
1 Like