I haven’t been developing for long, so the ProximityPrompt is new to me. I’ve read the documentation about it and used AI, but so far I haven’t found a solution.
Here is the problem: I want to make a GUI pop up after using the ProximityPrompt. This is what I used the script for:
local part = workspace:FindFirstChild("Part")
local proximityPrompt = part:FindFirstChildOfClass("ProximityPrompt")
if proximityPrompt then
proximityPrompt.Triggered:Connect(function(player)
print("Proximity Prompt von", player.Name, "ausgelöst")
local playerGui = player:FindFirstChild("PlayerGui")
if playerGui then
local screenGui = playerGui:FindFirstChild("GUI for vehicle")
local frame = screenGui:FindFirstChild("Frame")
if frame then
frame.Visible = true
print("GUI sichtbar für", player.Name)
end
end
end
end)
else
warn("ProximityPrompt nicht im Part gefunden!")
end
Basically, the script is working: I go to the part, activate the prompt, and it opens. I also have a button to close the GUI again with the script:
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local button = script.Parent
button.MouseButton1Click:Connect(function()
print("Button geklickt! Frame wird unsichtbar.")
local playerGui = player:FindFirstChild("PlayerGui")
if playerGui then
local screenGui = playerGui:FindFirstChild("GUI for vehicle")
if screenGui then
local frame = screenGui:FindFirstChild("Frame")
if frame then
frame.Visible = false
print("Frame für", player.Name, "wurde unsichtbar gemacht.")
end
end
end
end)
But after closing it, it is not able to reopen. The frame does not set Visible = true
after activating the prompt again. However, I do get the print statements that show me the function is launching, but it does not set the visibility to true. I also tried it on another game and it did also not work.
Any help or solution would be appreciated.