How would I go about pausing a loading bar tween that shows for everyone?

So I’ve currently not got anything to show with scripts, not at the moment anyway, I’m familiar with tweening and pausing, etc. But how would I go about doing this:

  • Player(s) interacts with a part/object and the loading bar that is a tween which is basically a progression bar (GUI) shows up.
  • If a player(s) was to move away from said part/object, the progression bar (GUI) isn’t visible and it pauses at the moment the player leaves.

This is very much easy in my head when it comes to doing all of this client sided, however, because I want the actual loading bar progression to be fully server sided so it shows the same amount of progress for everyone on the server, it’s becoming more confusing for me to try and think how I would go about PAUSING it, and RESUMING the tween server-sided. Has anyone done anything similar, or know of a way? I’ve tried searching it up before I go about writing anything up, but there’s nothing really about it.

u could use IntValues (30 characters)

Tween wouldn’t work with an IntValue tho, right? As in the tween goal? I’m wanting to pause the tween if a player was to leave the specific area, this will pause it for all players though.

I believe you can tween int values. Just tween the Value property,

Just use an event that indicates to all clients whether they should resume or pause the loading. In the same event that indicates pausing or resuming, passing the actual % along would also be useful. If network sync is an issue, you could instead send an event indicating pause/resume with % and time started/ended in order to keep the progress bar fully synchronized irregardless of network jitter or latency.

I don’t know if bumping is a thing here, but I’m having a small issue when it comes to showing the actual tween progress for everyone, not just locally.

rEvents.GenCountdown.OnClientEvent:Connect(function()

local TS = game:GetService("TweenService")
local gui = MainUI.Generator.Gen1Bar
local TI = TweenInfo.new(10,Enum.EasingStyle.Linear, Enum.EasingDirection.InOut,0,false,0)
local createAnim = TS:Create(gui, TI, {Size = Goal})

while true do
wait(0.2)
if (humanoid.Position - Gen2.Position).Magnitude < checkRange and eKeyDown() then
createAnim:Play()
else
createAnim:Pause()
       end
    end
end)

rEvents.GenCountdown:FireServer()

On my server script, it is just a basic FireAllClients().

What I’m trying to do is make the tween load and the progress to save/show the same progress for all clients, however, it’s not doing that and I feel like it’s a very simple mistake that I’m doing.

1 Like