I’ve been trying to make a custom clickable proximityprompt for a very, very long time. I actually have found a handful of posts on this website, but, they never elaborate on their solutions. All they say is “I just used InputHoldBegan() and InputHoldEnd()”. And I just can’t seem to understand.
I’ve been confused on this topic for a while, and the alternatives are causing a lot of bugs that I can’t seem to fix.
aren’t proximityprompts already clickable?
Forgot to add the word, ‘Custom’. Sorry.
oh ok. maybe use billboard gui’s that are clickable
That’s the problem, those won’t work. It causes too many bugs.
In the script:
local proximityprompt = script.Parent
proximityprompt.Triggered:Connect(function(playerWhoTriggered) --parameter is the player who triggered the prompt; player who clicked
-- do stuff; make player sit
local character = playerWhoTriggered.Character
local humanoid = character:FindFirstChild("Humanoid")
humanoid.Sit = true
end)
Properties of the ProximityPrompt:
HoldDuration sets how many seconds you want the player to hold their cursor before the prompt will take action so that it won’t run right away if the player accidentally touch the prompt for half a second only. ObjectText is to tell the player what the prompt will do. MaxActivationDistance is the distance the player needs to be within before the prompt is made visible for the player.
1 Like
Custom proximity prompt, sorry.
Style: Custom
Problem is, once you set the style to custom, you can’t click it.
Use BillboardGui. Put it in StarterGui. In the properties, set Adornee to the parent of the proximityprompt.
Make sure Enabled is not checked in the BillboardGui properties so that it will only show when prompt is visible only when within the distance set.
Make your billboardgui like a regular screengui with a button that you can click.
In the LocalScript:
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local proximityprompt = workspace:WaitForChild("Part"):WaitForChild("ProximityPrompt")
local billboardgui = script.Parent
local button = script.Parent:WaitForChild("Frame"):WaitForChild("TextButton")
proximityprompt.PromptShown:Connect(function() -- make billboardgui visible when it's supposed to be shown
billboardgui.Enabled = true
end)
proximityprompt.PromptHidden:Connect(function() -- make billboardgui disappear when it's supposed to be hidden
billboardgui.Enabled = false
end)
button.MouseButton1Click:Connect(function() -- what it does when the button is pressed
character:FindFirstChild("Humanoid").Sit = true
end)
4 Likes