local proxminityPrompt = script.Parent
proxminityPrompt.Triggered:Connect(function()
game.StarterGui.ScreenGui.ImageLabel.Visible = true
end)
I cannot seem to change the visibility of the UI ingame whether changing it in Explorer or in a script, I’m unsure if this is a bug or something wrong with my script. I cannot do in a completely fresh game either
local proximityPrompt = script.Parent
proximityPrompt.Triggered:Connect(function(player)
local playerGui = player:WaitForChild("PlayerGui")
local screenGui = playerGui:FindFirstChild("ScreenGui")
if screenGui then
local imageLabel = screenGui:FindFirstChild("ImageLabel")
if imageLabel then
imageLabel.Visible = true
end
end
end)
You can’t use local scripts in the workspace,
Instead have a script on the server and send a signal via remotes to the client/ player:
First create a remote event under replicatedstorage and call it proximityRemote
Server Script under the part:
local replicatedStorage = game:GetService("ReplicatedStorage")
local part = script.Parent
local proximityPrompt = part:FindFirstChildOfClass("ProximityPrompt")
local remote = replicatedStorage:WaitForChild("proximityRemote")
proximityPrompt.Triggered:Connect(function(player)
remote:FireClient(player)
end
Local script
local replicatedStorage = game:GetService("ReplicatedStorage")
local gui = script.Parent
local remote = replicatedStorage:WaitForChild("proximityRemote")
remote.OnClientEvent:Connect(function()
gui.Enabled = not gui.Enabled
end)
Thank you, but this is not the core issue I cannot seem to change the visibility state of any GUI whether script or not. I have eliminated all external factors and it still happens even in completely new games
I realised I had some bugs in the script, changing the visibility in the properties does not work, so that made me think that this script wasn’t working. Still a bug if the state of a GUI cannot be changed in the properties tab. But the script does work (thank you @jellolemo for the working scripts btw)