Prompt hold duration circle not showing

So i have made a door script where i have made so if u don’t hold the key the hold duration is 0 and when u hold the key then its 1 but for some reason the hold duration circle won’t show up when u are holding the key even tho the duration is set to 1.

the circle is the circle that is around the prompt button when holding it down

help is appreciated.

here is my code if needed

hitbox.Touched:Connect(function(hit)
	if game.Players:GetPlayerFromCharacter(hit.Parent) and hit.Parent.Humanoid.Health ~= 0 then
		if hit.Parent:FindFirstChild("Room1 Key") then
			prompt.HoldDuration = 1
		elseif not hit.Parent:FindFirstChild("Room1 Key") then
			prompt.HoldDuration = 0
		end
	end
end)

I dont see anything wrong in the sciprt so im just gonna tell you to check if the keys name is correct. “Room1 key”.
Also u need to hit some part to activate that function, so make sure u did that.

i have a hitbox and it does register when its touched and it changes the hold duration but the problem is it looks like this instead of this

when holding the key and pressing it down it looks like this.
https://gyazo.com/db191e38b42d60c805a4c9de838ea7bc

what i want it to look like after i changed the hold duration:
https://gyazo.com/70f76ae07501d8db215495ca3a419072

btw i just removed the hitbox script when i showcased what i wanted it to look like

but what i want to achieve is that i can change the hold duration and then the circle hold thing will pop up
example. when the hold duration is nil then its just instant with no circle and when its 1 in hold duration then the circle pops up

i know im bad at explaining

Idk why it doesnt work but i just want to know if this part is even firing, can u try printing something when this happens?

it does fire it just won’t show the circle thing but thanks for your help i will figure it out.

Ok so i tried it myself and i realized there rly was an issue not updating the prompt.
To fix this i would recomment making 2 prompts. 1 Without key and other with a key, and disable/enable them when holding a key. This worked perfectly for me.

image

local Hitbox = script.Parent.HitBox
local Lock = script.Parent.Lock
local NoKeyPrompt = Lock.NoKey
local KeyPrompt = Lock.Key

Hitbox.Touched:Connect(function(Hit)
	if game.Players:GetPlayerFromCharacter(Hit.Parent) and Hit.Parent.Humanoid.Health > 0 then
		local Key = Hit.Parent:FindFirstChild("Room1 Key")
		if Key then
			KeyPrompt.Enabled = true
			NoKeyPrompt.Enabled = false
		else
			KeyPrompt.Enabled = false
			NoKeyPrompt.Enabled = true
		end
	end
end)
1 Like

thanks