adicione tambem de habilitar a gui "Livro", ah e crie uma tabela das guis para caso eu…
- User
adicione tambem de habilitar a gui "Livro", ah e crie uma tabela das guis para caso eu precise adicionar mais futuramente : local player = game.Players.LocalPlayer local playerGui = player:WaitForChild("PlayerGui") local TweenService = game:GetService("TweenService")
local function disableGui() local acenarGui = playerGui:FindFirstChild("Acenar") if acenarGui and acenarGui.Enabled then local imageButton = acenarGui:FindFirstChild("ImageButton") if imageButton then local tweenInfo = TweenInfo.new(0.3, Enum.EasingStyle.Linear) local tween = TweenService:Create(imageButton, tweenInfo, {ImageTransparency = 1}) tween:Play() tween.Completed:Connect(function() acenarGui.Enabled = false -- Desabilita a GUI após a animação end) else acenarGui.Enabled = false -- Caso o ImageButton não seja encontrado end end end
local function onCharacterAdded(character) local humanoid = character:WaitForChild("Humanoid")
codelocal function onSeatedChanged() local acenarGui = playerGui:FindFirstChild("Acenar") if not acenarGui then -- Se a GUI não foi encontrada, tente aguardar que ela seja adicionada ao PlayerGui acenarGui = playerGui:WaitForChild("Acenar", 5) -- Aguarda até 5 segundos if not acenarGui then warn("Acenar GUI não encontrada no PlayerGui.") return end end local seatPart = humanoid.SeatPart if seatPart and seatPart.Name == "Sala_Aula" then -- O jogador sentou em um seat chamado 'Sala_Aula' acenarGui.Enabled = true -- Habilita a GUI -- Animação suave de exibição da ImageButton local imageButton = acenarGui:FindFirstChild("ImageButton") if not imageButton then -- Se o ImageButton não existe, aguarda por ele imageButton = acenarGui:WaitForChild("ImageButton", 5) -- Aguarda até 5 segundos if not imageButton then warn("ImageButton não encontrado na GUI Acenar.") return end end imageButton.ImageTransparency = 1 -- Começa transparente local tweenInfo = TweenInfo.new(0.3, Enum.EasingStyle.Linear) local tween = TweenService:Create(imageButton, tweenInfo, {ImageTransparency = 0}) tween:Play() else disableGui() end end -- Conecta ao evento Died do Humanoid para desabilitar a GUI quando o jogador morrer humanoid.Died:Connect(function() disableGui() end) -- Conecta ao evento SeatPart humanoid:GetPropertyChangedSignal("SeatPart"):Connect(onSeatedChanged) -- Verifica se o jogador já está sentado no momento da adição do character onSeatedChanged() - Assistant