Here's my local script located in StarterGui > ScreenGUI > Music (button) > [Located here]
local button = script.Parent --colours (easier to use) Grey = button.BackgroundColor3 Green = Color3.new(0,1,0) Red = Color3.new(1,0,0) White = Color3.new(1,1,1) Lightblue = Color3.new(0,1,1)
--size (pointless, was meant to be removed but didn't)
NormalSize = UDim2.new(0, 0, 0, 40) NormalPosition = UDim2.new(0, 212, 0, 0)
--sounds (This is where I get the music from so the script can activate it S1 = script.Parent.Parent.Sound1 S2 = script.Parent.Parent.Sound2 S3 = script.Parent.Parent.Sound3 ERRORSOUND = script.Parent.Parent.ERROR OPEN = script.Parent.Parent.OPEN Main1 = script.Parent.ThemeTune
--rules (eh) HasPressedPlay = false TABOPEN = false OPEN2 = false
--children (none)
function MouseIsIn()
if TABOPEN == false then
button.BackgroundTransparency = 0.1
button.BorderColor3 = Green
button.TextColor3 = Green
button.Text = "-MUSIC-"
S3:play()
end
end
function MouseIsOut()
if TABOPEN == false then
button.BackgroundTransparency = 0.05
button.BorderColor3 = Grey
button.TextColor3 = White
button.Text = "MUSIC"
end
end
function MouseIsDown()
if OPEN2 == false then
TABOPEN = true button.BackgroundTransparency = 0.1 button.BorderColor3 = Green button.TextColor3 = Green button.Text = "GRANTED"
wait(.5)
Main1:play()
button.BorderColor3 = Lightblue
button.TextColor3 = Lightblue
button.Text = "PLAYING"
OPEN2 = true
elseif OPEN2 == true then
button.BackgroundTransparency = 0.1
button.BorderColor3 = Green
button.TextColor3 = Green
button.Text = "STOPPING"
wait(.5)
button.BorderColor3 = Grey
button.TextColor3 = White
button.Text = "MUSIC"
Main1:stop()
TABOPEN = false
OPEN2 = false
end
end
button.MouseEnter:connect(MouseIsIn) button.MouseLeave:connect(MouseIsOut) button.MouseButton1Down:connect(MouseIsDown)player = game.Players.LocalPlayer
If you could please explain and point out any mistake I made please that would be a lot of help I place this script in a button GUI called Music with a sound file called ThemeTune and a local script (This one right here)

1 comment
Studio does not know the difference between local and server scripts