I made two serperate scripts, because then it only worked. The commands only work once. I need serious help.
Script One (Open Lobby)
01 | --DO NOT CHANGE!!! |
02 |
03 | local isAdmin = { [ "bosswalrus" ] = true , [ "BrockHCCS" ] = true , [ "mac3na3na" ] = true , [ "ultimatedeathwolf" ] = true , [ "BJL008" ] = true , [ "bealot" ] = true } |
04 |
05 | --Open Lobby Function |
06 | function onChatted(message, player) |
07 | --Open Lobby |
08 | if message = = "open/lobby" and isAdmin [ player.Name ] then |
09 | game.Workspace.LobbyDoor.LobbyDoorPart.Transparency = 1 |
10 | game.Worksapce.LobbyDoor.LobbyDoorPart.CanCollide = false |
11 | end |
12 | end |
13 |
14 | game.Players.PlayerAdded:connect( function (player) |
15 | player.Chatted:connect( function (message) onChatted(message, player) end ) |
16 | end ) |
Script Two (Close Lobby)
01 | --DO NOT CHANGE!!! |
02 | local isAdmin = { [ "bosswalrus" ] = true , [ "BrockHCCS" ] = true , [ "mac3na3na" ] = true , [ "ultimatedeathwolf" ] = true , [ "BJL008" ] = true , [ "bealot" ] = true } |
03 |
04 | --Open Lobby Function |
05 | function onChatted(message, player) |
06 | --Open Lobby |
07 | if message = = "close/lobby" and isAdmin [ player.Name ] then |
08 | game.Workspace.LobbyDoor.LobbyDoorPart.Transparency = 0 |
09 | game.Worksapce.LobbyDoor.LobbyDoorPart.CanCollide = true |
10 | end |
11 | end |
12 |
13 | game.Players.PlayerAdded:connect( function (player) |
14 | player.Chatted:connect( function (message) onChatted(message, player) end ) |
15 | end ) |
The commands only work once. I need serious help.
Well, your two scripts are exactly the same... They both open the door. You need to make one of them set the Transparency to 0 and the Can Collide to true, and also change the command for one, like "close/lobby" or something. You can also use just one script and use an elseif. So,
1 | if message = = "open/lobby" and isAdmin [ player.Name ] then |
2 | game.Workspace.LobbyDoor.LobbyDoorPart.Transparency = 1 |
3 | game.Worksapce.LobbyDoor.LobbyDoorPart.CanCollide = false |
4 | elseif message = = "close/lobby" and isAdmin [ player.Name ] then |
5 | game.Workspace.LobbyDoor.LobbyDoorPart.Transparency = 0 |
6 | game.Worksapce.LobbyDoor.LobbyDoorPart.CanCollide = true |
7 | end |
I think this would make your code work, but it's still kind of ugly. Here's how I do my holo scripts:
01 | local admins = { "bob" , "jeff" , "john" , "joe" } |
02 |
03 | function isAdmin(name) |
04 | for i,v in pairs (admins) do |
05 | if v:lower() = = name:lower() then |
06 | return true |
07 | end |
08 | end |
09 | return false |
10 | end |
11 |
12 | game.Players.PlayerAdded:connect( function (plr) |
13 | if isAdmin(plr.Name) then |
14 | plr.Chatted:connect( function (msg) |
15 | --stuff |
16 | end ) |
17 | end |
18 | end ) |
It's really your choice though. I have a holo script in my models if you want to study it.
local isAdmin = {"bosswalrus", "BrockHCCS", "mac3na3na", "ultimatedeathwolf", "BJL008","bealot"} local firstl = ":" --Set to something you want like :openl or c/openl
function checkadmin(name) for _,v in pairs(isAdmin) do if name:lower() == isAdmin:lower() then return true end end return false end
game.Players.PlayerAdded:connect(function(plr) if checkadmin(plr.Name) then plr.Chatted:connect(function(msg) if msg:lower():sub(2,7) == "closel" and msg:sub(1,1) == firstl then game.Workspace.LobbyDoor.LobbyDoorPart.Transparency = 0 game.Worksapce.LobbyDoor.LobbyDoorPart.CanCollide = true end if msg:lower():sub(2,6) == "openl" and msg:sub(1,1) == first then game.Workspace.LobbyDoor.LobbyDoorPart.Transparency = 1 game.Worksapce.LobbyDoor.LobbyDoorPart.CanCollide = false end end)