it worked with number and i added letter now it stoped working
local morseCode = {
["a"] = ".-",
["b"] = "-...",
["c"] = "-.-.",
["d"] = "-..",
["e"] = ".",
["f"] = "..-.",
["g"] = "--.",
["h"] = "....",
["i"] = "..",
["j"] = ".---"
["k"] = "-.-",
["l"] = ".-..",
["m"] = "--",
["n"] = "-.",
["o"] = "---",
["p"] = ".--.",
["q"] = "--.-",
["r"] = ".-.",
["s"] = "...",
["t"] = "-"
["u"] = "..-",
["v"] = "...-",
["w"] = ".--",
["x"] = "-..-",
["y"] = "-.--",
["z"] = "--.."
[","] = ".-.-.-",
["."] = "--..--",
["?"] = "..--..",
["/"] = "-..-.",
["@"] = ".--.-."
["1"] = ".----",
["2"] = "..---",
["3"] = "...--",
["4"] = "....-",
["5"] = "....."
["6"] = "-....",
["7"] = "--...",
["8"] = "---..",
["9"] = "----.",
["0"] = "-----"
}
local sequence = "14"
wait(5)
local part = workspace.MorsePart
local light = part
local dotSound = script.Parent.Dot
local dashSound = script.Parent.Dash
local function blinkLight(duration, sound)
light.Material = "Neon"
sound:Play()
wait(duration)
light.Material = "Plastic"
wait(duration)
end
local function playMorseCode(char)
local code = morseCode[char]
for i = 1, #code do
local symbol = code:sub(i, i)
if symbol == "." then
blinkLight(0.2, dotSound)
elseif symbol == "-" then
blinkLight(0.6, dashSound)
end
end
end
local function playSequence()
for i = 1, #sequence do
local char = sequence:sub(i, i)
playMorseCode(char)
wait(1)
end
end
while true do
playSequence()
wait(10)
end