Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local TweenService = game:GetService("TweenService")
- local LoadingBar = script.Parent.Progress
- local MainFrame = script.Parent.Parent.Announcement
- local function tweenPosition(object, targetPosition, duration)
- local tweenInfo = TweenInfo.new(duration, Enum.EasingStyle.Quad, Enum.EasingDirection.Out)
- local tween = TweenService:Create(object, tweenInfo, {Position = targetPosition})
- tween:Play()
- end
- local function tweenSize(object, targetSize, duration)
- local tweenInfo = TweenInfo.new(duration, Enum.EasingStyle.Linear, Enum.EasingDirection.Out)
- local tween = TweenService:Create(object, tweenInfo, {Size = targetSize})
- tween:Play()
- end
- game.ReplicatedStorage["RTS FlowMaster V1"].GateUpdate.OnClientEvent:Connect(function(gate, esttime)
- -- Ensure esttime is a number
- esttime = tonumber(esttime)
- if esttime and esttime > 0 then
- -- Tween to make MainFrame visible (updated in-view position)
- tweenPosition(MainFrame, UDim2.new(0, 129, 0, 47), 0.5)
- -- Set initial text
- script.Parent.Title.Text = "FlowMaster queue time updated"
- script.Parent.Content.Text = "The door/gate " .. gate .. " wait time has been updated! The current estimated wait time from the start is " .. esttime .. " seconds."
- -- Reset progress bar to initial size
- LoadingBar.Size = UDim2.new(0, 1, 0, 20)
- -- Tween progress bar to full size based on esttime
- tweenSize(LoadingBar, UDim2.new(0, 1030, 0, 20), esttime)
- -- Wait for the estimated time, then tween to hide MainFrame
- wait(5)
- tweenPosition(MainFrame, UDim2.new(0.101, 0, -0.2, 0), 0.5)
- -- Reset progress bar size after hiding the frame
- LoadingBar.Size = UDim2.new(0, 1, 0, 20)
- else
- warn("Invalid estimated time: " .. tostring(esttime))
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement