What is the function CompleteScreen, what is AnimalScreen, and what does this have to do with a quest? Also, is the visibility going back to true eventually before being set to false again?
local function CompleteScreen(Screen)
local Return_Button = Screen["Return Button"]
local Play_Button = Screen["Play Button"]
local Score = Screen.Score
local R_Color = Color3.fromRGB(226, 65, 65)
local R_TweenInfo = TweenInfo.new(0.3, Enum.EasingStyle.Sine, Enum.EasingDirection.Out)
local R_Tween = TweenService:Create(Return_Button, R_TweenInfo, {BackgroundColor3 = R_Color})
local R_Color = Color3.fromRGB(255, 73, 73)
local R_TweenInfo = TweenInfo.new(0.3, Enum.EasingStyle.Sine, Enum.EasingDirection.Out)
local R_LeaveTween = TweenService:Create(Return_Button, R_TweenInfo, {BackgroundColor3 = R_Color})
Return_Button.MouseEnter:Connect(function()
R_Tween:Play()
Return_Button.Font = "GothamBold"
end)
Return_Button.MouseLeave:Connect(function()
R_LeaveTween:Play()
Return_Button.Font = "GothamSemibold"
end)
Return_Button.MouseButton1Click:Connect(function()
Screen.Parent.Enabled = false
game.Players.LocalPlayer.PlayerGui["Game UI"].Enabled = true
end)
I don’t understand why you need what’s inside the function. My problem is with a solution for a function to run on frames visibility change. Are you proposing that there’s an issue inside the function?
local player = game.Players.LocalPlayer
local ui = player.PlayerGUi.AnimalScreen
-- Why is it called '10'?
ui["10"]:GetPropertyChangedSignal("Visible"):Connect(function()
print("visible:",ui["10"].Visible)
CompleteScreen(ui.CompletedScreen)
print("Finished complete screen")
end)