Can someone help me in this problem of making progress bar?

Okay. After further inspection I noticed you were using the stage values as a way to measure progress (ones stored at leaderstats). So you could actually use only a local script.
Here is just a rough edit just to get the point across.

local TS = game:GetService("TweenService")
local Players = game:GetService("Players")
local Local_player = game.Players.LocalPlayer
local verticalbar = script.Parent:WaitForChild("Vertical") 
local pointfolder = game.Workspace:WaitForChild("StartGuiRPlayer")
local startpoint = pointfolder:WaitForChild("Mulai")
local endpoint = pointfolder:WaitForChild("End")

local characters = {}
local StartToEnd = endpoint.Position - startpoint.Position

local ProgressTrackerRE = game:GetService("ReplicatedStorage"):WaitForChild("ProgressTracker")


local function update_get_player_ui(player, progression, n)
	if verticalbar:FindFirstChild(player.Name) then
		verticalbar:FindFirstChild(player.Name):Destroy()
	end
	local sample = script:WaitForChild("FotoPlayer"):Clone()
	sample.Name = player.Name
	sample.TextLabel.Text = player.Name
	sample.Position = UDim2.fromScale(progression,n)
	sample.Parent = verticalbar

	local s,e = pcall(function()
		sample.Image = Players:GetUserThumbnailAsync(player.UserId,Enum.ThumbnailType.HeadShot,Enum.ThumbnailSize.Size420x420)
	end)
	if not s then
		sample.Image = "rbxassetid://"..15847365339
	end



end



Players.PlayerAdded:Connect(function(player)
	update_get_player_ui(player, 0, 0.5)
end)
Players.PlayerRemoving:Connect(function(player)
	verticalbar:FindFirstChild(player.Name):Destroy()
end)

for i, player in pairs(game.Players:GetChildren()) do
	update_get_player_ui(player, 0, 0.5)
end

for i, player in pairs(game:GetService("Players"):GetChildren()) do
	local playerLeaderstat = player:WaitForChild("leaderstats")
	local playerStageNumber = playerLeaderstat:WaitForChild("Stage")
	playerStageNumber.Changed:Connect(function()
		local StartToPlayer = workspace.checkpoint:FindFirstChild(playerStageNumber.Value).Position - startpoint.Position
		local length = StartToEnd:Dot(StartToEnd)
		local progression = math.clamp(StartToPlayer:Dot(StartToEnd) / length,0,1) 
		update_get_player_ui(player, progression, 0.5)
	end)
end
1 Like