Generator type of effect from Dead by Daylight?

Currently working on something that is basically like Dead by Daylight’s Generator system.
So you interact with a part, loading bar progress shows, if you stop interacting with said part, the loading bar pauses.

This is part of the script I have atm:

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)

Is this the best way to go? If so, how would I go about showing that very same tween progress for all clients? As in, where would I place my Fire Server part inside that same script? I’m even unsure if tween is the best way to go about any of this…

If anyone has done anything similar, please let me know.

4 Likes