I've recently been experiment with spawn(), which allows you to run two while loops simultaneously, due to the spawn() event creating a thread for each function called inside the parentheses of spawn(). However, I'm not sure why my textbutton is not fading out. By creating a function that counts for when the button's BackgroundTransparency is less than or equal to x, I'm still stumped.
Here's the current code:
function campaign_FadeOut()
while campaign.BackgroundTransparency <= 0.8 do
campaign.BackgroundTransparency = campaign.BackgroundTransparency + .01
wait()
end
end
-- hierarchy is fine; I've put it through multiple tests, and they all work
if script.Parent.MainMenu.Menu.Start.LocalScript.Disabled == true then
UserInputService.InputBegan:connect(function(key) -- I still don't understand the bool inside the function, so I left it out; going to be reading up on that soon.
if key.UserInputType == Enum.UserInputType.Keyboard then
if key.KeyCode == Enum.KeyCode.Down then
if campaign.BackgroundTransparency <= 0.5 then
print("Woo, worked!")
spawn(multiplayer_FadeIn) -- the fadeIn function works fine
spawn(campaign_FadeOut) -- this function screws up
end
end
end
end)
end
Thoughts and suggestions are appreciated. Thanks!

2 comments
Um you dont have a wait() function between line 15 and 16
Managed to solve it, in the end. Was to do with another script, ahaha