Help with Proximity prompt and Frame

  1. What do you want to achieve?
    I want to make a frame Visible using proximity prompt

  2. What is the issue?
    frame is not visible

  3. What solutions have you tried so far?
    I tried my best to solve the issue, but it still doesn’t work ( I am an armateur scripter btw)

here is the script, it is in a part

local prompt = script.Parent.ProximityPrompt
local frame = game.StarterGui.ScreenGui:WaitForChild("Frame")

prompt.Triggered:Connect(function()
	print("pressed") --This work
	frame.Visible = true -- this doesn't
end)

image
part that the script is in

image
this is where the frame is located

1 Like

Put a local script in the frame and do this instead:

local prompt = game.Workspace.Computer.ProximityPrompt --I think this is it?
local frame = script.Parent

prompt.Triggered:Connect(function(plr)
   if plr == game.Players.LocalPlayer then
	print("pressed") --This work
	frame.Visible = true -- this doesn't
   end
end)

the script doesn’t work, there’s something wrong with this line (sorry if this sound rude)

local prompt = game.Workspace.Computer.ProximityPrompt -- this line doesn't work
local frame = script.Parent

prompt.Triggered:Connect(function(plr)
	if plr == game.Players.LocalPlayer then
		print("pressed")
		frame.Visible = true
	end
end)

Make that line a pathway to the Proximity Prompt in the workspace. I made a guess but it is wrong

I did but that still doesn’t work

If this is a LocalScript,

local prompt = script.Parent.ProximityPrompt
prompt.Triggered:Connect(function()
	print("pressed") --This work
	pcall(function()
		game:GetService("Players").LocalPlayer.PlayerGui.ScreenGui:WaitForChild("Frame").Visible = true
	end)
end)

If this is a Server Script,

local prompt = script.Parent.ProximityPrompt
prompt.Triggered:Connect(function()
	print("pressed") --This work
	pcall(function(playerWhoTriggered)
		playerWhoTriggered.PlayerGui.ScreenGui:WaitForChild("Frame").Visible = true
	end)
end)

It is always recommended to use LocalScripts when dealing with GuiObjects.

Then is it a local script and is it parented to the Frame itself?

yes it is, I’m currently trying @veilict 's solution but if it still doesn’t work I’ll try yours

I tried the script and it still doesn’t work

local prompt = script.Parent.ProximityPrompt

prompt.Triggered:Connect(function()
	print("pressed") --This doesn't print
	pcall(function()
		game:GetService("Players").LocalPlayer.PlayerGui.ScreenGui:WaitForChild("Frame").Visible = true
	end)
end)

Can you show us your explorer set up with the local script

Here it is
image

local script should be parented to the Gui frame in my example for it to work. The Gui frame and not in workspace because local scripts don’t run in workspace

1 Like

LocalScripts do not run in Workspace.

Put your LocalScript under the frame you want to become visible and change the code to this, similar to what @OfficialPogCat provided.

local prompt = workspace.Computer.ProximityPrompt

prompt.Triggered:Connect(function()
	print("pressed") --This doesn't print
	pcall(function()
		script.Parent.Visible = true
	end)
end)
1 Like

THANK YOU IT’S WORKING NOW, thank you so much

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.