Is there actually a way to update a tween for all clients and not just locally?

Hi,

I’ve recently been struggling to figure out a way to show a tween that is shown for all clients, not just one.
I’ve looked at things such as TweenService V2, but that doesn’t have a proper Complete function which is what I like about the normal TweenService.

It’s just rather an annoyance right now, the following script works well client side:

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)

However, it’s just the part of where I’m trying to replicate this for all clients. Has anyone done anything similar with tweens?

1 Like

Have a look into:

This should be enough to help you. If not report back and more help would be provided.

I had this running, but it wasn’t actually updating anything, if I was to put the FireServer in the if statement for if a player was to hold the E key down, it wouldn’t be updating the Tween

Are you using “UserInputService?”

The thing with remote functions and events, is you have to pass over a “player” object along with 2 other objects from the LocalScript

which in your case would be playing the “Tween”

Once you fired the server, did you do a :FIreAllClients() for the RemoteEvent?

He should stuff his information into a “local function tweenRun” and then run
“rEvents.GenCountdown:FireAllClients(tweenRun)”

Yes, I’m using UserInputService for this so it can see if the player is holding E.

Basically player holds the key E, is within the radius, and the tween starts to move. If the player was to let go of E, and leave the distance then the tween will pause.

If you want it to show for all clients then why not just add it on a ServerScript?

Putting tweening on the actual Server? I don’t feel comfortable with doing that, performance wise I can imagine it being awful, no?

Its easier but you’re right. Why not just do :FireAllClients???

A server-sided tween will probably have no problems running on a server. The issue would be client latency and lag.
:FireAllClients() works best.

1 Like