Hold E to pick up

Hey its me again. I have been struggling to code a way to pick up furniture for my game. I wanted to make it so you can hold E on something, and you can pick it up. I dont want to use Proximity Prompts because I dont like the UI, but I dont know how else I could achieve this.

I’m pretty sure you can custom design a proximity prompt

Could you give me an example or any resources to that?

I don’t know of any resources or how to do it but I’ve seen a custom option in properties.

There’s a WorldToScreenPoint So you can get the Position of your UI whenever you want to put it.

This is the Example script on it

local Camera = workspace.Camera
local gui = script.Parent
local Frame = gui.Frame
local Part = workspace.Part
local RunService = game:GetService"RunService"
RunService:BindToRenderStep("IconUpdate",Enum.RenderPriority.Last.Value,function()
	local vec = Camera:WorldToScreenPoint(Part.Position)
	Frame.Position = UDim2.new(
		0,
		vec.X,
		0,
		vec.Y
	)
end)```

It is possible to change the ProximityPrompt default UI. I am almost certain it is possible. (I have done somthing similar with ContextActionService before)

If you want to have something similar you can use BillboardGuis for the same effect.

There is an option to customize Proximity Prompts with a Local Script. Which is discussed here under the Customize section.

Thats what I used, but I need to know another thing, is it possible for me to use Tweens to Tween a straight progress bar while the invisible prompt is being held down?

Yes. But I woulnd’t really use one. It is possible to cancel a Tween.

Somethine like this maybe

-- Start of script or when player gets close to th eobject
local Tween: Tween = nil

UserInputService.InputBegan:Connect(function(inputObject,gameProcessedEvent)
    if gameProcessedEvent then return end
    if inputObject.KeyCode == KeycodeOfYourChoice then
        Tween = TweenService:Create(FrameToBeTweened,TweenInformation,Goal) 
        Tween:Play() 
    end
end)

UserInputService.InputEnded:Connect(function(inputObject) 
     if inputObject.KeyCode == KeycodeOfYourChoice then
        Tween:Stop() 
        Tween:Destroy()
    end
end)

I would rather connect a RenderStepped event and check each frame if the button is held. But, it is totally up to you.

Thanks. I ended up using the Proximity Prompt Event for PromptButtonHoldBegan to start the tween, and cancel it when PromptButtonHoldEnded fires, which works in coordination with the HoldTime property of the proximity prompt.

1 Like