The only thing you’d need to do besides making the morse code sound play, which you already have the code for, is to make it so the door opens when you chat the decoded morse code message. Which is quite simple given that the Chatted event exists for Player instances. An example would be this
local plrs = game:GetService("Players")
local door = --Your door
local text = "Taco"
plrs.PlayerAdded:Connect(function(plr)
plr.Chatted:Connect(function(msg)
if msg ~= text or not door.CanCollide then return end
door.CanCollide = false
wait(5)
door.CanCollide = true
end)
end)
If you write Taco and the door isn’t open, it’ll open it for 5 seconds. The basis you need is just to use the Chatted event, you’d probably have to add more conditions to check if the player is able to open the door (so they can’t just open it when they’re at the beginning of the game for exampel)
It’s all good now but I have a new problem. How would I stop it from changing numbers? I want it to pick a set of numbers and keep it until the player joins a new server and it changes.
Just check if it’s equal to num, no need for a NumberValue. Also, I’m not sure why you take the first 8 characters if it’s a five character code.
Edit: Actually the problem is that the while true do loop never ends, so the PlayerAdded event never gets connected to. Just put the event between where you define num and the loop is.