How do I make this Circle on Proximity Prompt

Hello, I wonder how do you make this kind of like progress circle when you’re holding the proximity prompt? Thx!

its called a circular progress bar
I suggest you to write own implementation but here is some code pieces i have from my own implementation:

--#include <stdraw.luau>
local SetProperty = select(2,xpcall(function():()
	(game::any)[nil]=nil
end,function():()
	return debug.info(2,"f")
end))::(ins:Instance,prop:string,val:any)->()
local GetProperty = select(2,xpcall(function():()
	return (game::any)[nil]
end,function():()
	return debug.info(2,"f")
end))::(ins:Instance,prop:string)->any
local GetService = GetProperty(game,"GetService")::(DataModel:DataModel,service:string)->Instance
--\include

local Players = GetService(game,"Players")::Players
local RunService = GetService(game,"RunService")::RunService
local BindToRenderStep = GetProperty(RunService,"BindToRenderStep")::(RunService,name: string, priority: number, func: (number)->())->()
local UnbindFromRenderStep = GetProperty(RunService,"UnbindFromRenderStep")::(RunService,name:string)->()

local CurrentTeam_Color = Color3.new(0.5,0.5,0.5)
local UDim2_one = UDim2.fromScale(1,1)
local LocalPlayer = GetProperty(Players,"LocalPlayer")::Player

--PickupCircularProgress
local UDim2_05_1_RIGHT_ARM=UDim2.fromScale(0.5,1)
local temp2_TriggerButtons_Workspace = UDim2.fromScale(2,1)

local temp_TriggerButtonEvent = NumberSequence.new({NumberSequenceKeypoint.new(0,0);NumberSequenceKeypoint.new(0.5,0);NumberSequenceKeypoint.new(0.501,1);NumberSequenceKeypoint.new(1,1);})

local PickupCircularProgress = Instance.new("ScreenGui") do
	SetProperty(PickupCircularProgress,"Enabled",false)
	SetProperty(PickupCircularProgress,"IgnoreGuiInset",true)
	SetProperty(PickupCircularProgress,"ResetOnSpawn",false)
	--SetProperty(PickupCircularProgress,"Name","PickupCircularProgress")
	SetProperty(PickupCircularProgress,"ScreenInsets",Enum.ScreenInsets.DeviceSafeInsets)
	SetProperty(PickupCircularProgress,"ZIndexBehavior",Enum.ZIndexBehavior.Sibling)
end
--[Children] {
local Progress = Instance.new("Frame") do
	SetProperty(Progress,"AnchorPoint",Vector2.new(0.5,0.5))
	SetProperty(Progress,"BackgroundTransparency",1)
	--SetProperty(Progress,"Name","Progress")
	SetProperty(Progress,"Position",UDim2.fromScale(0.5,0.5))
	SetProperty(Progress,"Size",UDim2.fromScale(0.2,0.2))
	SetProperty(Progress,"SizeConstraint",Enum.SizeConstraint.RelativeYY)
	SetProperty(Progress,"Parent",PickupCircularProgress)
end
--[Children] {
local Left = Instance.new("Frame") do
	SetProperty(Left,"BackgroundTransparency",1)
	SetProperty(Left,"ClipsDescendants",true)
	--SetProperty(Left,"Name","Left")
	SetProperty(Left,"Size",UDim2_05_1_RIGHT_ARM)
	SetProperty(Left,"Parent",Progress)
end
--[Children] {
local Left_ImageLabel = Instance.new("ImageLabel") do
	SetProperty(Left_ImageLabel,"BackgroundTransparency",1)
	SetProperty(Left_ImageLabel,"Image","rbxassetid://105643096275287")
	SetProperty(Left_ImageLabel,"ImageTransparency",0.5)
	SetProperty(Left_ImageLabel,"ImageColor3",CurrentTeam_Color)
	--SetProperty(Left_ImageLabel,"Name","Left_ImageLabel")
	SetProperty(Left_ImageLabel,"Size",temp2_TriggerButtons_Workspace)
	SetProperty(Left_ImageLabel,"Parent",Left)
end
--[Children] {
local Left_UIGradient = Instance.new("UIGradient",Left_ImageLabel) do
	--SetProperty(Left_UIGradient,"Name","Left_UIGradient")
	SetProperty(Left_UIGradient,"Transparency",temp_TriggerButtonEvent)
end
--}
--}
local Right_ImageLabel = Instance.new("ImageLabel")
SetProperty(Right_ImageLabel,"Size",temp2_TriggerButtons_Workspace)
--Right
temp2_TriggerButtons_Workspace = Instance.new("Frame") do
	SetProperty(temp2_TriggerButtons_Workspace,"AnchorPoint",Vector2.xAxis)
	SetProperty(temp2_TriggerButtons_Workspace,"BackgroundTransparency",1)
	SetProperty(temp2_TriggerButtons_Workspace,"ClipsDescendants",true)
	--SetProperty(Right,"Name","Right")
	SetProperty(temp2_TriggerButtons_Workspace,"Position",UDim2.fromScale(1,0))
	SetProperty(temp2_TriggerButtons_Workspace,"Size",UDim2_05_1_RIGHT_ARM)
	SetProperty(temp2_TriggerButtons_Workspace,"Parent",Progress)
end
--[Children] {
do
	SetProperty(Right_ImageLabel,"BackgroundTransparency",1)
	SetProperty(Right_ImageLabel,"Image","rbxassetid://105643096275287")
	SetProperty(Right_ImageLabel,"ImageTransparency",0.5)
	SetProperty(Right_ImageLabel,"ImageColor3",CurrentTeam_Color)
	--SetProperty(Right_ImageLabel,"Name","Right_ImageLabel")
	SetProperty(Right_ImageLabel,"Position",UDim2.fromScale(-1,0))
	SetProperty(Right_ImageLabel,"Parent",temp2_TriggerButtons_Workspace)
end

--[Children] {
local Right_UIGradient = Instance.new("UIGradient",Right_ImageLabel) do
	--SetProperty(Right_UIGradient,"Name","Right_UIGradient")
	SetProperty(Right_UIGradient,"Rotation",180)
	SetProperty(Right_UIGradient,"Transparency",temp_TriggerButtonEvent)
end
--}
--}
local ToHSV = CurrentTeam_Color.ToHSV
local Outline = Instance.new("ImageLabel") do
	SetProperty(Outline,"BackgroundTransparency",1)
	SetProperty(Outline,"Image","rbxassetid://89023536046235")
	do
		local h,s,v = ToHSV(CurrentTeam_Color)
		SetProperty(Outline,"ImageColor3",Color3.fromHSV(h,s-0.3,v))
	end
	--SetProperty(Outline,"Name","Outline")
	SetProperty(Outline,"Size",UDim2_one)
	SetProperty(Outline,"ZIndex",2)
	SetProperty(Outline,"Parent",Progress)
end
--}
--}
local PickupCircularProgress_Delta = 0
local PickupCircularProgress_Duration = 1
local temp4 = GetProperty(LocalPlayer,"PlayerGui")::PlayerGui

SetProperty(PickupCircularProgress,"Parent",temp4)
local PickUpProgressBar_connected:boolean = false

local PickUpProgressBar_Func_NextHalf = function(delta:number):()
	local PickupCircularProgress_Duration=PickupCircularProgress_Duration
	local globalDelta = delta+PickupCircularProgress_Delta
	if globalDelta>PickupCircularProgress_Duration then
		UnbindFromRenderStep(RunService,"ProgressBar")
		PickUpProgressBar_connected = false
		SetProperty(Progress,"Visible",false)
		SetProperty(PickupCircularProgress,"Enabled",false)
		return
	end
	PickupCircularProgress_Delta=globalDelta
	local Procentage = globalDelta/PickupCircularProgress_Duration
	SetProperty(Left_UIGradient,"Rotation",Procentage*360)
end

local PickUpProgressBar_Func = function(delta:number):()
	--local PickupCircularProgress_Duration=PickupCircularProgress_Duration
	local globalDelta = delta+PickupCircularProgress_Delta

	PickupCircularProgress_Delta=globalDelta
	local Procentage = globalDelta/PickupCircularProgress_Duration
	--right
	if Procentage<0.5 then
		SetProperty(Right_UIGradient,"Rotation",Procentage*360)
		return
	end
	--left
	UnbindFromRenderStep(RunService,"ProgressBar")
	BindToRenderStep(RunService,"ProgressBar",1,PickUpProgressBar_Func_NextHalf)
	PickUpProgressBar_Func_NextHalf(0)
	SetProperty(Right_UIGradient,"Rotation",180)
	SetProperty(Left,"Visible",true)
end

--[[you need to enable SetProperty(PickupCircularProgress,"Enabled",true)
and then disable it aswell SetProperty(PickupCircularProgress,"Enabled",false)
]]
local StartPickupProgressBar = function(duration:number):()
	if PickUpProgressBar_connected then UnbindFromRenderStep(RunService,"ProgressBar") end
	PickUpProgressBar_connected=true
	PickupCircularProgress_Delta=0
	PickupCircularProgress_Duration=duration
	SetProperty(Left_UIGradient,"Rotation",180)
	SetProperty(Right_UIGradient,"Rotation",0)
	SetProperty(Left,"Visible",false)
	BindToRenderStep(RunService,"ProgressBar",1,PickUpProgressBar_Func)
	SetProperty(Progress,"Visible",true)
	SetProperty(PickupCircularProgress,"Enabled",true)
end
local CancelPickUpProgressBar = function():()
	if PickUpProgressBar_connected then 
		UnbindFromRenderStep(RunService,"ProgressBar")
		PickUpProgressBar_connected=false
	end
	SetProperty(PickupCircularProgress,"Enabled",false)
	SetProperty(Progress,"Visible",false)
end


return {
	[1]  = StartPickupProgressBar;
	[2]  = CancelPickUpProgressBar;
}

You need an image aswell for example this one (replace "rbxassetid://105643096275287" (bar) and "rbxassetid://89023536046235" (frame) with the image ids)


3 Likes

The code looks kinda odd because i have been writing it for my game under a very specific conditions where i had to reuse variables for optimization purposes so yeah.

2 Likes