I have a script that plays a song and when it does it has a variable called tempo. The tempo changes depending on the song. And I am trying to let tempo be accessed in another script but it says unknown global?
Theres the first script, tempo is only in the first block with Mr Blue Sky
local MrBlueSky = 862680756
local Believer = 685388224
local HowFarItGoes = 1058515832
local music = script.Parent
local musictitle = script.Parent.MusicName.MusicTeller.MusicTitle
local tempo = wait()
while true do
wait()
musicpicker = math.random(1,3)
if musicpicker == 1 then
musictitle.Text = "ELO - Mr Blue Sky"
music.SoundId = "rbxassetid://"..MrBlueSky
music:Play()
music.PlaybackSpeed = 1
music.Volume = 2
tempo = wait(.3)
music.Ended:wait()
wait(3)
end
if musicpicker == 2 then
musictitle.Text = "Imagine Dragons - Believer"
music.SoundId = "rbxassetid://"..Believer
music:Play()
music.PlaybackSpeed = 1
music.Volume = 2
music.Ended:wait()
wait(3)
end
if musicpicker == 3 then
musictitle.Text = "Moana - How Far I'll Go"
music.SoundId = "rbxassetid://"..HowFarItGoes
music:Play()
music.PlaybackSpeed = 0.673
music.Volume = 2.5
music.Ended:wait()
wait(3)
end
end
brick = script.Parent
while true do
color = math.random(1,5)
if color == 1 then
brick.BrickColor = BrickColor.new(196/255, 40/255, 28/255) -- Bright Red
wait(tempo)
end
if color == 2 then
brick.BrickColor = BrickColor.new(4/255, 175/255, 236/255) -- Cyan
wait(tempo)
end
if color == 3 then
brick.BrickColor = BrickColor.new(52/255, 142/255, 64/255) -- Sea Green
wait(tempo)
end
if color == 4 then
brick.BrickColor = BrickColor.new(123/255, 47/255, 123/255) -- Plum
wait(tempo)
end
if color == 5 then
brick.BrickColor = BrickColor.new(218/255, 133/255, 65/255) -- Bright Orange
wait(tempo)
end
end
Tempo is blue in this script and there both scripts not local scripts so I figured they could access each other. But they cant and I am a little confused on it.

2 comments
The easy way to do this would be to just make a NumberValue so that both scripts are able to see it and set its value if necessary. Just be sure it's not somewhere that an exploiter can interact with it.
AHHH NOT LOCAL VARIABLES THAT MAKE THE SCRIPT WASTE MORE TIME FINDING GLOBALS