Big Script doesnt work

So,I am doing a normal script for the tutorial. But from line 8 to line 20 nothing works. This is script. It should turn on the music when player pressed the button, but if playing false it doesn’t work. And with true the music starts playing without pressing the button.

local button = script.Parent

	while wait(0.2) do
		script.Parent.Text ="Rickroll!"	 
local Sound = game.SoundService.Sound
		local played = false
			if played == false then
		played = true


1 Like

This is Explained on the script eh

local Button = script.Parent -- Ur Button Location

--Keeping the Original Values will changed on the function as if the activation back to false or turn off
local OriginalColor ="Color3Value", Button) 
OriginalColor.Value = Button.BackgroundColor3

local OriginalText ="StringValue", Button)
OriginalText.Value = Button.Text

local Activated = false -- Activation

Button.MouseButton1Down:Connect(function() -- Function
	local Sound = game.SoundService.Sound -- Ur Sound location
	if Activated == false then -- Confirming if the activation 
		Activated = true -- making the activation true cuz its running right now
		Sound:Play() -- Playing the sound as the activation true
		Button.Text = "RickRoll!" -- The Text On The Function
		repeat -- repetition for the background changing color
			Button.BackgroundColor3 = Color3.fromRGB(math.random(1, 255), math.random(1, 255), math.random(1, 255)) 
		until -- stops when the activation is now false
		Activated == false
		Activated = false -- Turning the activation to false for pressing again which stops the function
		Sound:Stop() -- Stops the sound as the activation false 
		-- Applying the original properties changed on the function
		wait(0.3) -- Delation for the loop changing color cuz the loop changing color still might running and wont back the button original color
		Button.BackgroundColor3 = OriginalColor.Value 
		Button.Text = OriginalText.Value 
1 Like

Nothing changed. Maybe make another script?

I really dont know whats the error but did you try putting them in the exact location
cuz it works perfectly fine to me eh

1 Like