I’m sure the answer to this is simple, it’s just I’m only now doing ProximityPrompts so I’m extremely clueless about this.
What do I want to achieve? I want it so when the player triggers the ProximityPrompt the Gui Frame “PFrame” will be visible.
*the proximity prompt is a child in my character, my character is located in the workspace."
code:
local starterGUI = game.StarterGui
local WaterCanxiety = game.Workspace.WaterCanxiety:WaitForChild("WaterCanxiety")
local ProximityPrompt = WaterCanxiety:WaitForChild("ProximityPrompt")
local player = game.Players.LocalPlayer
local PFrame = game.StarterGui.ScreenGui.PFrame
if ProximityPrompt.Triggered then
game.StarterGui.ScreenGui.PFrame.Visible = true
end
ProximityPrompt.Triggered is an event, not a value.
Use:
ProximityPrompt.Triggered:Connect(function()
game.StarterGui.ScreenGui.PFrame.Visible = true
end
Yes, it is a local script, i made some code changes also:
local starterGUI = game.StarterGui
local player = game.Players.LocalPlayer
local PFrame = game.StarterGui.ScreenGui.PFrame
local ProximityPrompt = game.Workspace.WaterCanxiety.ProximityPrompt
ProximityPrompt.Triggered:Connect(function()
game.StarterGui.ScreenGui.PFrame.Visible = true
end)
I’m not much of a scripter, but I’m pretty sure scripts under workspace can’t easily make guis pop up because of FilteringEnabled so exploiters can’t ruin you game. Its possible, but I don’t have the knowledge of making scripts under workspace make guis.
You could try making a script under screengui somewhere, maybe that’ll work
local starterGUI = game.StarterGui
local WaterCanxiety = game.Workspace.WaterCanxiety:WaitForChild("WaterCanxiety")
local ProximityPrompt = WaterCanxiety:WaitForChild("ProximityPrompt")
local player = game.Players.LocalPlayer
local PFrame = game.StarterGui.ScreenGui.PFrame
ProximityPrompt.Triggered:Connect(function(p)
p.PlayerGui.ScreenGui.PFrame.Visible = true
end
local WaterCanxiety = game.Workspace:WaitForChild("WaterCanxiety")
local ProximityPrompt = WaterCanxiety:WaitForChild("ProximityPrompt")
local player = game:GetService("Players").LocalPlayer
local PlayerGui = player:WaitForChild("PlayerGui")
local PFrame = PlayerGui.ScreenGui.PFrame
ProximityPrompt.Triggered:Connect(function()
PFrame.Visible = true
end)