Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I make !open and !close work infinitely?

game.Players.PlayerAdded:Connect(function(plr)
    plr.Chatted:Connect(function(msg)
            if msg:sub(1, 5) == "!open" or msg:sub(1, 5) == "!Open" then
            if plr:GetRankInGroup(5370359) >= 12 then
                workspace.Door.Transparency = 1
			    workspace.Door.CanCollide = false
			end
        end
    end)
end) 

game.Players.PlayerAdded:Connect(function(plr)
    plr.Chatted:Connect(function(msg)
            if msg:sub(1, 5) == "!close" or msg:sub(1, 5) == "!Close" then
            if plr:GetRankInGroup(5370359) >= 12 then
                workspace.Door.Transparency = 1
			    workspace.Door.CanCollide = false
			end
        end
    end)
end) 

How do I make it so !open and !close can be used infinitely?

1 comment

0

Try using if then statements to check if the door is open or closed and use debounce for cooldowns. Just a guess.

1 answer

✓ Accepted answer
if msg:sub(1, 5) == "!close" or msg:sub(1, 5) == "!Close" then

The word, !close and !Close have 6 characters, not 5. That's your error and that's why it won't close on line 14.

2 comments

0

Thank you! I did not notice that!

0

No problem! Just make sure you always double check your code.

This discussion is preserved as it was. New answers, comments, and votes are closed.