Hold-to-Interact Progress Meter thumbnail
0 views0 copies0 likes

Hold-to-Interact Progress Meter

Universal script

Copy it, then test it in your own Studio place.

UI systems Verified

Script code

26 lines · 1.1 KB
Download
local service = game:GetService("ProximityPromptService")local RunService = game:GetService("RunService")local player = game:GetService("Players").LocalPlayerlocal gui = Instance.new("ScreenGui", player:WaitForChild("PlayerGui"))gui.ResetOnSpawn = falselocal track = Instance.new("Frame", gui)track.AnchorPoint = Vector2.new(0.5, 0)track.Position, track.Size = UDim2.fromScale(0.5, 0.75), UDim2.fromOffset(170, 12)track.Visible = falselocal fill = Instance.new("Frame", track)fill.BackgroundColor3 = Color3.fromRGB(64, 230, 219)local active, beganservice.PromptButtonHoldBegan:Connect(function(prompt, who)	if who ~= player or prompt.HoldDuration <= 0 then return end-- …open Get script for the full source

About this script

Give a ProximityPrompt a HoldDuration greater than zero, then install this LocalScript to display a progress bar when the player starts holding its control. The bar grows from empty using the prompt duration and disappears on completion or release. The prompt still owns the interaction. Test holding halfway and walking away, then compare the keyboard and touch controls.

Comments

Share what works, ask questions, or report an issue.

0

Log in to leave a comment.

No comments yet

Be the first to share your thoughts!

Raw Luau source

local service = game:GetService("ProximityPromptService")
local RunService = game:GetService("RunService")
local player = game:GetService("Players").LocalPlayer
local gui = Instance.new("ScreenGui", player:WaitForChild("PlayerGui"))
gui.ResetOnSpawn = false
local track = Instance.new("Frame", gui)
track.AnchorPoint = Vector2.new(0.5, 0)
track.Position, track.Size = UDim2.fromScale(0.5, 0.75), UDim2.fromOffset(170, 12)
track.Visible = false
local fill = Instance.new("Frame", track)
fill.BackgroundColor3 = Color3.fromRGB(64, 230, 219)
local active, began
service.PromptButtonHoldBegan:Connect(function(prompt, who)
	if who ~= player or prompt.HoldDuration <= 0 then return end
	active, began = prompt, os.clock()
	track.Visible = true
end)
local function finish(prompt)
	if active == prompt then active = nil; track.Visible = false end
end
service.PromptButtonHoldEnded:Connect(finish)
service.PromptHidden:Connect(finish)
service.PromptTriggered:Connect(finish)
RunService.RenderStepped:Connect(function()
	if active then fill.Size = UDim2.fromScale(math.clamp((os.clock() - began) / active.HoldDuration, 0, 1), 1) end
end)