My script that I have created makes a GUI visible when I press the key "R". However when I run the script and press R the GUI says that it is visible in the properties, however I still cannot see the GUI. I think the problem lies inside the settings of the GUI but I haven't found any errors.
Side note: The script is local and is stored in the Starterpack.
Here is a picture of my GUI that I want to open: https://gyazo.com/bda261e322fcf93ed675369de887bc80
Here is my code:
repStorage = game:GetService("ReplicatedStorage")
BuildRoad = repStorage:WaitForChild("BuildRoad")
BuildStructure = repStorage:WaitForChild("BuildStructure")
while game.Players.LocalPlayer == nil do
wait()
end
plr = game.Players.LocalPlayer
mouse = plr:GetMouse()
local RoadBuilding = script.Parent.Parent.StarterGui.ScreenGui.RoadBuilding
mouse.KeyDown:Connect(function(key)
if key == "r" then
print("pressing r")
if game.StarterGui.ScreenGui.RoadBuilding.Visible == false then
print("closed to open")
game.StarterGui.ScreenGui.RoadBuilding.Visible = true
else
print("open to closed")
game.StarterGui.ScreenGui.RoadBuilding.Visible = false
end
end
end)
