You can write your topic however you want, but you need to answer these questions:
I want to make it so that whenever the user presses their space bar, the ui becomes invisible.
The issue, is that my script won’t work, but doesn’t even return any errors.
The script was working before. But now it doesn’t seem to work, I’ve made sure it’s enabled, and when the gui IS shown, I check, and it’s Visible property is ticked.
local mouse = game.Players.LocalPlayer:GetMouse()
while script.Parent.Visible == true do
wait(0.01)
print("wait")
mouse.KeyDown:connect(function(key)
if key:byte() == 32 then
print("off")
script.Parent.Visible = false
end
end)
end
script.Parent.Visible = true
game.UserInputService.InputBegan:Connect(function(i ,gpe)
if gpe then return end
if i.KeyCode == Enum.KeyCode.Space then
script.Parent.Visible = not script.Parent.Visible
end
end)
bud it’s not working, I changed it to this (still doesn’t work):
‘’'script.Parent.Visible = false
game.UserInputService.InputBegan:Connect(function(i ,gpe)
if gpe then return end
if i.KeyCode == Enum.KeyCode.Space then
script.Parent.Visible = true
end
end)``
No, your script never worked. My orginial script WAS working, but even when I didn’t change it, now it doesn’t work. I remember it working last night and now it doesn’t work.
script.Parent.Visible = true
game.UserInputService.InputBegan:Connect(function(i ,gpe)
if gpe then return end
print("yes")
if i.KeyCode == Enum.KeyCode.Space then
print("yay")
script.Parent.Visible = not script.Parent.Visible
print(script.Parent.Visible)
end
end)
wait whatt, it’s not changing the GUI, also I changed it to:
script.Parent.Visible = false
game.UserInputService.InputBegan:Connect(function(i ,gpe)
if gpe then return end
print("yes")
if i.KeyCode == Enum.KeyCode.Space then
print("yay")
script.Parent.Visible = true
print(script.Parent.Visible)
end
end)