Hi!
Just a quick thing as I’m rushing right now, My click script isn’t working as expected. It only plays the hover one every now and then.
What’s wrong?
Thanks!
Click script:
local SoundClick = Instance.new("Sound",script.Parent)
SoundClick.SoundId = "rbxassetid://178104975"
local SoundEnter = Instance.new("Sound",script.Parent)
SoundEnter.SoundId = "rbxassetid://5991592592"
SoundEnter.Volume = 2
SoundClick.Volume = .1
if script.Parent.Visible == true then
script.Parent.MouseButton1Click:Connect(function()
SoundClick:Play()
end)
script.Parent.MouseEnter:Connect(function()
SoundEnter:Play()
end)
script.Parent.MouseLeave:Connect(function()
SoundEnter:Play()
end)
end
Distribute script:
local a = 0
local b = 0
local ended = false
local SOUND = script.Sound
function RemoveTableDupes(tab)
local hash = {}
local res = {}
for _,v in ipairs(tab) do
if (not hash[v]) then
res[#res+1] = v
hash[v] = true
end
end
return res
end
task.wait(15)
local OBJECTS = {}
for i, obj in pairs(game.Players.LocalPlayer:WaitForChild("PlayerGui"):GetDescendants()) do
if obj:IsA("GuiObject") and obj.Parent ~= script.Parent and obj.Parent.Parent ~= script.Parent then
--Found a GuiObject
if obj:IsA("ImageButton") then
a += 1
table.insert(OBJECTS, obj)
end
elseif obj:IsA("TextButton") then
a+=1
table.insert(OBJECTS, obj)
end
end
OBJECTS = RemoveTableDupes(OBJECTS)
function OpenLoading()
local frame = game.Players.LocalPlayer.PlayerGui.ChangeSetting.Frame
frame.Visible = true
frame.lab.Text = "Initalizing..."
task.wait(2)
end
function CloseLoading()
local frame = game.Players.LocalPlayer.PlayerGui.ChangeSetting.Frame
frame.Visible = false
end
local function SetAllColors(color)
for i, obj in pairs(OBJECTS) do
if obj:IsA("GuiObject") and obj.Parent ~= script.Parent and obj.Parent.Parent ~= script.Parent then
--Found a GuiObject
task.wait()
if obj:IsA("ImageButton") then
b += 1
local e = Instance.new("Sound")
e.SoundId = "rbxassetid://178104975"
e.Volume = 2
e.Parent = script
e:Play()
local scr = script.LocalScript:Clone()
scr.Parent = obj.Parent
scr.Disabled = false
e:Destroy()
end
elseif obj:IsA("TextButton") then
b += 1
local e = Instance.new("Sound")
e.SoundId = "rbxassetid://178104975"
e.Volume = 2
e.Parent = obj
e:Play()
local scr = script.LocalScript:Clone()
scr.Parent = obj.Parent
scr.Disabled = false
e:Destroy()
end
end
end
game.Players.LocalPlayer.PlayerGui.ChangeSetting.Frame.lab.Text = "Loading.. ["..b.."/"..a.."]"
ended = true
SetAllColors(game.Players.LocalPlayer:WaitForChild("Theme").Value)
local SoundClick = Instance.new("Sound",script.Parent)
SoundClick.SoundId = "rbxassetid://178104975"
local SoundEnter = Instance.new("Sound",script.Parent)
SoundEnter.SoundId = "rbxassetid://5991592592"
SoundEnter.Volume = 2
SoundClick.Volume = .1
script.Parent.MouseButton1Click:Connect(function()
if script.Parent.Visible == true then
SoundClick:Play()
end
end)
script.Parent.MouseEnter:Connect(function()
if script.Parent.Visible == true then
SoundEnter:Play()
end
end)
script.Parent.MouseLeave:Connect(function()
if script.Parent.Visible == true then
SoundEnter:Play()
end
end)
local SoundClick = Instance.new("Sound",script.Parent)
SoundClick.SoundId = "rbxassetid://178104975"
local SoundEnter = Instance.new("Sound",script.Parent)
SoundEnter.SoundId = "rbxassetid://5991592592"
SoundEnter.Volume = 2
SoundClick.Volume = .1
local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
local Hovering = false
Mouse.Button1Down:Connect(function()
if script.Parent.Visible == true and Hovering == true then
SoundClick:Play()
end
end)
script.Parent.MouseEnter:Connect(function()
Hovering = true
if script.Parent.Visible == true then
SoundEnter:Play()
end
end)
script.Parent.MouseLeave:Connect(function()
Hovering = false
if script.Parent.Visible == true then
SoundEnter:Play()
end
end)
No, it’s still under the deploy script, if you look at the console it’s giving a ton of errors with putting it into frames and folders, with Commander and Build for some reason
local a = 0
local b = 0
local ended = false
local SOUND = script.Sound
function RemoveTableDupes(tab)
local hash = {}
local res = {}
for _,v in ipairs(tab) do
if (not hash[v]) then
res[#res+1] = v
hash[v] = true
end
end
return res
end
task.wait(15)
local OBJECTS = {}
for i, obj in pairs(game.Players.LocalPlayer:WaitForChild("PlayerGui"):GetDescendants()) do
if obj:IsA("GuiObject") and obj.Parent ~= script.Parent and obj.Parent.Parent ~= script.Parent then
--Found a GuiObject
if obj:IsA("ImageButton") then
a += 1
table.insert(OBJECTS, obj)
end
elseif obj:IsA("TextButton") then
a+=1
table.insert(OBJECTS, obj)
end
end
OBJECTS = RemoveTableDupes(OBJECTS)
function OpenLoading()
local frame = game.Players.LocalPlayer.PlayerGui.ChangeSetting.Frame
frame.Visible = true
frame.lab.Text = "Initalizing..."
task.wait(2)
end
function CloseLoading()
local frame = game.Players.LocalPlayer.PlayerGui.ChangeSetting.Frame
frame.Visible = false
end
local function SetAllColors()
for i, obj in pairs(OBJECTS) do
if obj:IsA("GuiObject") and obj.Parent ~= script.Parent and obj.Parent.Parent ~= script.Parent then
--Found a GuiObject
task.wait()
if obj:IsA("ImageButton") then
b += 1
local e = Instance.new("Sound")
e.SoundId = "rbxassetid://178104975"
e.Volume = 2
e.Parent = script
e:Play()
local scr = script.LocalScript:Clone()
scr.Parent = obj.Parent
scr.Disabled = false
e:Destroy()
end
elseif obj:IsA("TextButton") then
b += 1
local e = Instance.new("Sound")
e.SoundId = "rbxassetid://178104975"
e.Volume = 2
e.Parent = obj
e:Play()
local scr = script.LocalScript:Clone()
scr.Parent = obj.Parent
scr.Disabled = false
e:Destroy()
end
end
end
game.Players.LocalPlayer.PlayerGui.ChangeSetting.Frame.lab.Text = "Loading.. ["..b.."/"..a.."]"
ended = true
SetAllColors()
local SoundClick = Instance.new("Sound",script.Parent)
SoundClick.SoundId = "rbxassetid://178104975"
local SoundEnter = Instance.new("Sound",script.Parent)
SoundEnter.SoundId = "rbxassetid://5991592592"
SoundEnter.Volume = 2
SoundClick.Volume = .1
local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
local Hovering = false
Mouse.Button1Down:Connect(function()
if script.Parent.Visible == true and Hovering == true then
SoundClick:Play()
end
end)
script.Parent.MouseEnter:Connect(function()
Hovering = true
if script.Parent.Visible == true then
SoundEnter:Play()
end
end)
script.Parent.MouseLeave:Connect(function()
Hovering = false
if script.Parent.Visible == true then
SoundEnter:Play()
end
end)
I changed the scripts around, and it should work now. I don’t think you will need to detect if something is visible, because it is on client, but you can decide to remove it or not. (Remove the visible checking, if it doesn’t work, but there are no errors.) You should know where the scripts go, by the looks of it.
local SoundClick = Instance.new("Sound",script.Parent)
SoundClick.SoundId = "rbxassetid://178104975"
local SoundEnter = Instance.new("Sound",script.Parent)
SoundEnter.SoundId = "rbxassetid://5991592592"
SoundEnter.Volume = 2
SoundClick.Volume = .1
script.Parent.MouseButton1Down:Connect(function()
if script.Parent.Parent.Visible == true then
SoundClick:Play()
end
end)
script.Parent.MouseEnter:Connect(function()
if script.Parent.Parent.Visible == true then
SoundEnter:Play()
end
end)
script.Parent.MouseLeave:Connect(function()
if script.Parent.Parent.Visible == true then
SoundEnter:Play()
end
end)
local a = 0
local b = 0
local ended = false
local SOUND = script.Sound
function RemoveTableDupes(tab)
local hash = {}
local res = {}
for _,v in ipairs(tab) do
if (not hash[v]) then
res[#res+1] = v
hash[v] = true
end
end
return res
end
task.wait(15)
local OBJECTS = {}
for i, obj in pairs(game.Players.LocalPlayer:WaitForChild("PlayerGui"):GetDescendants()) do
if obj:IsA("GuiObject") and obj ~= script.Parent and obj.Parent ~= script.Parent then
--Found a GuiObject
if obj:IsA("ImageButton") then
a += 1
table.insert(OBJECTS, obj)
end
elseif obj:IsA("TextButton") then
a+=1
table.insert(OBJECTS, obj)
end
end
OBJECTS = RemoveTableDupes(OBJECTS)
function OpenLoading()
local frame = game.Players.LocalPlayer.PlayerGui.ChangeSetting.Frame
frame.Visible = true
frame.lab.Text = "Initalizing..."
task.wait(2)
end
function CloseLoading()
local frame = game.Players.LocalPlayer.PlayerGui.ChangeSetting.Frame
frame.Visible = false
end
local function SetAllColors()
for i, obj in pairs(OBJECTS) do
if obj:IsA("GuiObject") and obj ~= script.Parent and obj.Parent ~= script.Parent then
--Found a GuiObject
task.wait()
if obj:IsA("ImageButton") then
b += 1
local e = Instance.new("Sound")
e.SoundId = "rbxassetid://178104975"
e.Volume = 2
e.Parent = script
e:Play()
local scr = script.LocalScript:Clone()
scr.Parent = obj
scr.Disabled = false
e:Destroy()
end
elseif obj:IsA("TextButton") then
b += 1
local e = Instance.new("Sound")
e.SoundId = "rbxassetid://178104975"
e.Volume = 2
e.Parent = obj
e:Play()
local scr = script.LocalScript:Clone()
scr.Parent = obj
scr.Disabled = false
e:Destroy()
end
end
end
game.Players.LocalPlayer.PlayerGui.ChangeSetting.Frame.lab.Text = "Loading.. ["..b.."/"..a.."]"
ended = true
SetAllColors()
It seems you put an elseif statement in the wrong spot. Try this:
local a = 0
local b = 0
local ended = false
local SOUND = script.Sound
function RemoveTableDupes(tab)
local hash = {}
local res = {}
for _,v in ipairs(tab) do
if (not hash[v]) then
res[#res+1] = v
hash[v] = true
end
end
return res
end
task.wait(15)
local OBJECTS = {}
for i, obj in pairs(game.Players.LocalPlayer:WaitForChild("PlayerGui"):GetDescendants()) do
if obj:IsA("GuiObject") and obj ~= script.Parent and obj.Parent ~= script.Parent then
--Found a GuiObject
if obj:IsA("ImageButton") then
a += 1
table.insert(OBJECTS, obj)
elseif obj:IsA("TextButton") then
a+=1
table.insert(OBJECTS, obj)
end
end
end
OBJECTS = RemoveTableDupes(OBJECTS)
function OpenLoading()
local frame = game.Players.LocalPlayer.PlayerGui.ChangeSetting.Frame
frame.Visible = true
frame.lab.Text = "Initalizing..."
task.wait(2)
end
function CloseLoading()
local frame = game.Players.LocalPlayer.PlayerGui.ChangeSetting.Frame
frame.Visible = false
end
local function SetAllColors()
for i, obj in pairs(OBJECTS) do
if obj:IsA("GuiObject") and obj ~= script.Parent and obj.Parent ~= script.Parent then
--Found a GuiObject
task.wait()
if obj:IsA("ImageButton") then
b += 1
local e = Instance.new("Sound")
e.SoundId = "rbxassetid://178104975"
e.Volume = 2
e.Parent = script
e:Play()
local scr = script.LocalScript:Clone()
scr.Parent = obj
scr.Disabled = false
e:Destroy()
elseif obj:IsA("TextButton") then
b += 1
local e = Instance.new("Sound")
e.SoundId = "rbxassetid://178104975"
e.Volume = 2
e.Parent = obj
e:Play()
local scr = script.LocalScript:Clone()
scr.Parent = obj
scr.Disabled = false
e:Destroy()
end
end
end
end
game.Players.LocalPlayer.PlayerGui.ChangeSetting.Frame.lab.Text = "Loading.. ["..b.."/"..a.."]"
ended = true
SetAllColors()
[I EDITED THIS AFTER SENDING IT, ONE TIME, SO IF IT DOESN’T WORK, RE-COPY THIS]