I am trying to make a menu for my game, which I have open with a proximity prompt. I open it, then close it, but after the 2nd time I open, then close it, it wont open again. I had this issue before on another project, but I forgot how to fix it.
(Normal Script which is triggered after proximity prompt is used)
script.Parent.Triggered:Connect(function(player)
print(player.Name .. " has triggered the prompt.")
if not player.PlayerGui:FindFirstChild("ScreenGui") then
print("yes")
local gui = game.ServerScriptService.ScreenGui:Clone()
gui.Parent = player.PlayerGui
else
player.PlayerGui.ScreenGui.MainGUI:TweenPosition(UDim2.new(0.169, 0, 0.173, 0),1,2,1)
end
end)
I believe this is happening because you’re opening the UI on the server, however you’re closing it on the client. It might be a better idea to fire a remote to the client to open the UI as well, rather than having that take place on the server.