Hello everyone.
I’m just in the middle of scripting a new main menu for a group I’m in. I have it setup to where if they click a button, it’ll play a sound, but if the button exists in another part of the GUI, it’ll play the following tween:
The problem is, the script as it stands specifically names the button like this:
for i, v in pairs(base:GetDescendants()) do
if v:IsA("TextButton") then
v.MouseEnter:Connect(function()
sfx.Hover:Play()
end)
v.MouseButton1Click:Connect(function()
if v.Name == "Teams" then --<HERE
selectedframe = v.Name
local slidein = ts:Create(base.Main[selectedframe], TweenInfo.new(0.5), {Position = UDim2.new(0, 0, 0, 0)})
local slideout = ts:Create(base.Main[currentframe], TweenInfo.new(0.5), {Position = UDim2.new(-1, 0, 0, 0)})
slidein:Play()
slideout:Play()
currentframe = v.Name
end
sfx.Click:Play()
end)
end
end
But when I use FindFirstChild, it doesn’t do anything. No error is there, and I have checked that the instance does infact exist where I specified.
v.MouseButton1Click:Connect(function()
if v.Name == base.Main:FindFirstChild(v.Name) then
selectedframe = v.Name
local slidein = ts:Create(base.Main[selectedframe], TweenInfo.new(0.5), {Position = UDim2.new(0, 0, 0, 0)})
local slideout = ts:Create(base.Main[currentframe], TweenInfo.new(0.5), {Position = UDim2.new(-1, 0, 0, 0)})
slidein:Play()
slideout:Play()
currentframe = v.Name
end
It doesn’t display errors, so I have no idea what to do here. Can I get some help please?