here is the full script for detecting when the button is being click and a few other things.
local Rezonate = Instance.new("Sound")
local NewFolder = Instance.new("Folder")
local RezonateSoundID = "rbxassetid://6932928276"
local RS = game:GetService("ReplicatedStorage")
local RemoteEvent = RS:WaitForChild("RemoteEvent")
local SettingsButton = script.Parent.SettingsButton
local SettingsFrame = script.Parent.SettingsButton.SettingsFrame
local MusicLabel = script.Parent.SettingsButton.SettingsFrame.MusicBackground.MusicLabel
local MusicToggle = script.Parent.SettingsButton.SettingsFrame.MusicBackground.MusicToggle
local MusicBackground = script.Parent.SettingsButton.SettingsFrame.MusicBackground
local GuiToggle = script.Parent.SettingsButton.SettingsFrame.GuiBackground.GuiToggle
local GuiBackground = script.Parent.SettingsButton.SettingsFrame.GuiBackground
local ShopButton = script.Parent.SettingsButton.ShopButton
local ClickSound = game.ReplicatedStorage.Click
local MusicToggleSound = game.ReplicatedStorage.MusicToggleSound
local BlurEffect = game.Lighting.Blur
local player = game.Players.LocalPlayer
local humanoid = player.Character:FindFirstChild("Humanoid")
local canToggle = true
SettingsButton.MouseButton1Click:Connect(function()
if SettingsFrame.Visible == false and canToggle then
canToggle = false
ClickSound:Play()
humanoid.WalkSpeed = 0
humanoid.JumpPower = 0
if humanoid.WalkSpeed > 1 and humanoid.JumpPower then
RemoteEvent:FireServer()
end
ShopButton.Visible = false
SettingsFrame.Visible = true
BlurEffect.Enabled = true
SettingsFrame:TweenPosition(
UDim2.new(17.573, 0,-7.358, 0),
Enum.EasingDirection.Out,
Enum.EasingStyle.Sine,
1,
false
)
delay(1, function()
canToggle = true
end)
elseif canToggle then
canToggle = false
ClickSound:Play()
SettingsFrame:TweenPosition(
UDim2.new(24.573, 0,-7.358, 0),
Enum.EasingDirection.In,
Enum.EasingStyle.Quart,
1,
false
)
delay(1, function()
BlurEffect.Enabled = false
ShopButton.Visible = true
SettingsFrame.Visible = false
player.Character:FindFirstChild("Humanoid").WalkSpeed = 16
player.Character:FindFirstChild("Humanoid").JumpPower = 50
canToggle = true
end)
end
end)
MusicToggle.MouseButton1Click:Connect(function()
if MusicToggle.Position == UDim2.new(0, 0,0, 0) then
MusicToggleSound:Play()
MusicToggle.Position = UDim2.new(0.762, 0,0, 0)
MusicToggle.BackgroundColor3 = Color3.fromRGB(0, 189, 91)
MusicBackground.BackgroundColor3 = Color3.fromRGB(0, 255, 127)
NewFolder.Name = "RezonateFolder"
NewFolder.Parent = player
Rezonate.Looped = true
Rezonate.Volume = 2.5
Rezonate.Name = "Rezonate"
Rezonate.SoundId = RezonateSoundID
Rezonate.Parent = player:WaitForChild("RezonateFolder")
Rezonate:Play()
MusicToggle.Text = "On"
MusicLabel.Text = "Music (Activated)"
MusicLabel.TextColor3 = Color3.fromRGB(0, 189, 91)
else
MusicToggleSound:Play()
MusicToggle.Position = UDim2.new(0, 0,0, 0)
MusicToggle.BackgroundColor3 = Color3.fromRGB(170, 0, 0)
MusicBackground.BackgroundColor3 = Color3.fromRGB(84, 84, 84)
MusicLabel.TextColor3 = Color3.fromRGB(170, 0, 0)
MusicToggle.Text = "Off"
MusicLabel.Text = "Music (De-Activated)"
Rezonate:Stop()
end
end)
GuiToggle.MouseButton1Click:Connect(function()
if GuiToggle.Position == UDim2.new(0, 0,0, 0) then
GuiToggle.Position = UDim2.new(0.762, 0,0, 0)
MusicToggleSound:Play()
GuiToggle.BackgroundColor3 = Color3.fromRGB(0, 189, 91)
GuiBackground.BackgroundColor3 = Color3.fromRGB(0, 255, 127)
GuiToggle.Text = "On"
player.Character:FindFirstChild("Humanoid").Health = 0
MusicToggle.Position = UDim2.new(0, 0,0, 0)
MusicToggle.BackgroundColor3 = Color3.fromRGB(170, 0, 0)
MusicBackground.BackgroundColor3 = Color3.fromRGB(84, 84, 84)
NewFolder:Destroy()
BlurEffect.Enabled = false
end
if SettingsFrame.Visible == true then
SettingsFrame.Visible = false
end
end)