So, I have this screen GUI. It doesn't appear when enabled in game, unless it starts out enabled. Pls help.
permission = {"Greatnate09"}
function checkOkToLetIn(name)
for i = 1,#permission do
if (string.upper(name) == string.upper(permission[i])) then return true end
end
return false
end
local Door = script.Parent
function onTouched(hit)
local human = hit.Parent:findFirstChild("Humanoid")
if (human ~= nil ) then
if (checkOkToLetIn(human.Parent.Name)) then
game.StarterGui.ScreenGui.Enabled = true
game.ServerScriptService.Script.Disabled = true
game.Workspace.Music.Sound1:Stop()
game.Workspace.Music.Sound2:Stop()
game.Workspace.Music.Sound3:Stop()
game.Workspace.Music.Sound4:Stop()
game.Workspace.Sound:Play()
game.Workspace.MusicOn.Script.Disabled = true
game.Workspace.MusicOff.Script.Disabled = true
wait(300)
game.StarterGui.ScreenGui.Enabled = false
game.Workspace.Sound:Stop()
game.Workspace.MusicOn.Script.Disabled = false
game.Workspace.MusicOff.Script.Disabled = false
end
end
end
script.Parent.Touched:connect(onTouched)
All you really need to do is keep it enabled but instead the main frame inside the gui turn the value visible off. Then using the script turn the value visible on again. Also you have to change the gui inside of the players gui not the starter gui. Get to the players "PlayerGui" using
local Plr = game.Players:GetPlayerFromCharacter(human.Parent) local gui = Plr:WaitForChild("PlayerGui")
Good luck
I fixed it. All i had to do is put a local script in starter gui reading a string value in replicated storage which i edited in my script above.