I was using ProximityPrompts to change a frames visibility. It didn't work even though I tried both types of scripts (local and server). While using a server script I got the error
"Workspace.JuicePart.ProximityPrompt.Script:2: attempt to index nil with 'WaitForChild' "
and the local script gave no errors but still didn't work. I also tried using FindFirstChild and that also didn't work.
Code:
local player = game.Players.LocalPlayer
local DrinksFrame = player:WaitForChild("PlayerGui").ShopUi.Drinks
game.Workspace.JuicePart.ProximityPrompt.Triggered:Connect(function() --wait until the ProximityPrompt is triggered
print("Juice shop opened")
wait()
DrinksFrame.Visible = true -- try to set the visibility to true
end)
