#My morse code does not work

1 messages · Page 1 of 1 (latest)

rancid granite
#

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

clear stag
#

i mean i prob know but

#

i just dont rly get the local char = sequence:sub()

#

dont think it rly works

#

cant u just

#

i got lost nvm

#

just lmk what local char is

#

print it or sum

rancid granite
#

its said "syntax error expected a "." after table contruture element" and its on like 6 of them

rancid granite
#

what?

clear stag
#

or which line at least

#

send screenshot

#

or say which line

rancid granite
#

im kinds new to this

clear stag
rancid granite
clear stag
#

u forgot ,

#

on prev lines or on that line

rancid granite
#

ok ill chack

#

check

rancid granite
#

ty

#

ty