ProximityPrompt Not Changing Visible Property

Hello, I am trying to create a script for a ProximityPrompt where a TextButton becomes visible once activated. I also have a LocalScript inside of the TextButton which sets visible to false once it’s activated, which works perfectly fine.

The issue is that the script only works the first time, and afterwards the TextButton doesn’t become visible. I added a print statement to the function which verified that it’s the line which changes .Visible which doesn’t work.

HouseDoorPrompt.Triggered:Connect(function(player)
	player.PlayerGui.TeleportOptions.StoreTeleportGui.Visible = true
	print('x')
end)
local player = game.Players.LocalPlayer
local PlayerGui = player.PlayerGui

script.Parent.Activated:Connect(function()
	PlayerGui.TeleportOptions.StoreTeleportGui.Visible = false
end)

Any help would be appreciated, thanks!

sounds like the first script is a normal script and the second an local script, If the scripts are different, the GUIObject will be visible on the server and it cannot be invisible again on the client, consider making both scripts an local script

1 Like

Since this is part of the players model and doesn’t appear in the workspace on the server, you will want to put this for that variable

local PlayerGui = player:WaitForChild("PlayerGui")
1 Like

You could either use two local scripts or use a remote event. If you wanted to use a remote event, it would look something similar to this.

local remote = game.ReplicatedStorage.Remote
HouseDoorPrompt.Triggered:Connect(function(player)
    remote:FireClient(player)
	print('x')
end)
local remote = game.ReplicatedStorage.Remote

local player = game.Players.LocalPlayer
local PlayerGui = player.PlayerGui

script.Parent.Activated:Connect(function()
	PlayerGui.TeleportOptions.StoreTeleportGui.Visible = false
end)

remote.OnClientEvent:Connect(function()
    PlayerGui.TeleportOptions.StoreTeleportGui.Visible = true
end)
1 Like