[ Free ] Custom Proximity Prompt

Custom Proximity Prompt / Overhaul for default ProximityPrompt

Simply insert the LocalScript into ‘StarterPlayerScripts’ and the script will handle the rest.

Simple & tidy design.

Very basic & tidy design for Users; can be customised and changed.

Custom Colors / CornerRadius

By using simple attributes (‘Color3’ = Color3, ‘CornerRadius’ = Udim2) The user is able to set individual Colors & CornerRadius of the UI.
1302665a0baeee916a6d5f1b2b23b08f


MORE FEATURES COMING SOON - Got an idea? Leave it below. ^^

Get a copy of the model here.

26 Likes

Does this support mobile too so you can hold it down from a screen like regular proximity prompts.

2 Likes

Hi!
I completely forgot about this. :face_with_peeking_eye:
I’m not 100% sure however I am actually working on a replacement for this that does support mobile so I will update once complete. :blush:

1 Like

Erroring at line 68:


	local Core = { ... }
	local Server, Self = game, script
	
	local UserInputService = Server:GetService('UserInputService')
	local ProximityPromptService = Server:GetService('ProximityPromptService')
	
	local Player = Server:GetService('Players').LocalPlayer
	local Character, Humanoid
	local CF

--||--||--||

	function Core:ScreenGui(...)
		local ScreenGui = Player:WaitForChild('PlayerGui', 1):FindFirstChild('ProximityPrompt')
		if not ScreenGui then
			ScreenGui = Instance.new('ScreenGui')
			ScreenGui.Name = 'ProximityPrompt'
			ScreenGui.ResetOnSpawn = false
			ScreenGui.Parent = Player:WaitForChild('PlayerGui', 1)
		end
		return ScreenGui
	end
	
	function Core:Tween(Obj, Info, Properties, ...)
		local TweenService = Server:GetService('TweenService')
		TweenService:Create(Obj, Info, Properties	):Play(...)
	end
	
	function Core:Disconnect(table, ...)
		for a, b in pairs (table) do
			if b ~= nil then
				b:Disconnect(...)
				b = nil
			end
		end
	end

--||--||--||

	function Core:CreatePrompt(ProximityPrompt, InputType, ScreenGui, ...)
		local H, S, V
		
		local Mouse1Down, Mouse1Up
		local HoldBegan, HoldEnded
		local Triggered, TriggerEnded
		
		local PromptUI = Self:WaitForChild('PromptUI', 1):Clone(...)
		PromptUI.Adornee = ProximityPrompt.Parent
		if ProximityPrompt:GetAttribute('Color3') then
			PromptUI.Frame.BackgroundColor3 = ProximityPrompt:GetAttribute('Color3')
		end
		if ProximityPrompt:GetAttribute('CornerRadius') then
			PromptUI.Frame.UICorner.CornerRadius = ProximityPrompt:GetAttribute('CornerRadius')
			PromptUI.Frame.Progress.UICorner.CornerRadius = ProximityPrompt:GetAttribute('CornerRadius')
		end
		
		H, S, V = PromptUI.Frame.BackgroundColor3:ToHSV()
		PromptUI.Frame.Progress.BackgroundColor3 = Color3.fromHSV(H, S, V + (255/255))
		PromptUI.Parent = ScreenGui
		
		PromptUI.Frame.ButtonText.Text = UserInputService:GetStringForKeyCode(ProximityPrompt.KeyboardKeyCode)
		PromptUI.Frame.ObjectText.Text = ProximityPrompt.ObjectText
		PromptUI.Frame.ActionText.Text = ProximityPrompt.ActionText
		
		Triggered = ProximityPrompt.Triggered:Connect(function(...)
			PromptUI.Enabled = false
			CF = Character:GetPivot(...) -- here
			TriggerEnded = ProximityPrompt.TriggerEnded:Connect(function(...)
				TriggerEnded:Disconnect(...)
				PromptUI.Enabled = true
			end)
		end)
		
		HoldBegan = ProximityPrompt.PromptButtonHoldBegan:Connect(function(a, b, c)
			local Progress = PromptUI.Frame.Progress
			Progress.Visible = true
			Progress.UIScale.Scale = 0

			Core:Tween(Progress.UIScale, TweenInfo.new(ProximityPrompt.HoldDuration), {Scale = 1})

			HoldEnded = ProximityPrompt.PromptButtonHoldEnded:Connect(function(...)
				Core:Disconnect({HoldEnded})
				Progress.Visible = false
				Progress.UIScale.Scale = 0
			end)
		end)	
		
		Mouse1Down = PromptUI.TextButton.MouseButton1Down:Connect(function(...)
			ProximityPrompt:InputHoldBegin()
			Mouse1Up = PromptUI.TextButton.MouseButton1Up:Connect(function(...)
				Mouse1Up:Disconnect(...)
				ProximityPrompt:InputHoldEnd()
			end)
		end)
		
		ProximityPrompt.PromptHidden:Wait(...)
		
		PromptUI:Destroy(...)
		
		Core:Disconnect({Mouse1Down, Mouse1Up, HoldBegan, HoldEnded, Triggered, TriggerEnded})
	end

--||--||--||

	Player.CharacterAdded:Connect(function(CharacterAdded, ...)
		Character = CharacterAdded
		Humanoid = Character:WaitForChild('Humanoid', 1)
	end)
	
	ProximityPromptService.PromptShown:Connect(function(ProximityPrompt, InputType, ...)
		if ProximityPrompt.Style == Enum.ProximityPromptStyle.Custom then
			local ScreenGui = Core:ScreenGui(...)
			Core:CreatePrompt(ProximityPrompt, InputType, ScreenGui, ...)
		end
	end)

--||--||--||

	return Core
CF = Character:GetPivot(...) -- here

The error is: ProximityPrompt:68: attempt to index nil with 'GetPivot'

EDIT: I ended up deleting it and it did nothing. If it does anything I’ll let you know. Also not expecting any replies any time soon.

2 Likes

If there are those who get this error, if you replace the code with this, it will be fixed.

local Core = {}
local Server, Self = game, script

local UserInputService = Server:GetService('UserInputService')
local ProximityPromptService = Server:GetService('ProximityPromptService')
local Players = Server:GetService('Players')

local Player : Player = Players.LocalPlayer
local Character : Model, Humanoid
local CF

--||--||--||

function Core:ScreenGui(...)
	local ScreenGui = Player:WaitForChild('PlayerGui', 1):FindFirstChild('ProximityPrompt')
	if not ScreenGui then
		ScreenGui = Instance.new('ScreenGui')
		ScreenGui.Name = 'ProximityPrompt'
		ScreenGui.ResetOnSpawn = false
		ScreenGui.Parent = Player:WaitForChild('PlayerGui', 1)
	end
	return ScreenGui
end

function Core:Tween(Obj, Info, Properties, ...)
	local TweenService = Server:GetService('TweenService')
	TweenService:Create(Obj, Info, Properties):Play(...)
end

function Core:Disconnect(table, ...)
	for a, b in pairs(table) do
		if b ~= nil then
			b:Disconnect(...)
			table[a] = nil
		end
	end
end

--||--||--||

function Core:CreatePrompt(ProximityPrompt, InputType, ScreenGui, ...)
	local H, S, V

	local Mouse1Down, Mouse1Up
	local HoldBegan, HoldEnded
	local Triggered, TriggerEnded

	local PromptUI = Self:WaitForChild('PromptUI', 1):Clone(...)
	PromptUI.Adornee = ProximityPrompt.Parent

	if ProximityPrompt:GetAttribute('Color3') then
		PromptUI.Frame.BackgroundColor3 = ProximityPrompt:GetAttribute('Color3')
	end

	if ProximityPrompt:GetAttribute('CornerRadius') then
		PromptUI.Frame.UICorner.CornerRadius = ProximityPrompt:GetAttribute('CornerRadius')
		PromptUI.Frame.Progress.UICorner.CornerRadius = ProximityPrompt:GetAttribute('CornerRadius')
	end

	H, S, V = PromptUI.Frame.BackgroundColor3:ToHSV()
	PromptUI.Frame.Progress.BackgroundColor3 = Color3.fromHSV(H, S, math.clamp(V + (255/255), 0, 1))

	PromptUI.Parent = ScreenGui

	PromptUI.Frame.ButtonText.Text = UserInputService:GetStringForKeyCode(ProximityPrompt.KeyboardKeyCode)
	PromptUI.Frame.ObjectText.Text = ProximityPrompt.ObjectText
	PromptUI.Frame.ActionText.Text = ProximityPrompt.ActionText

	Triggered = ProximityPrompt.Triggered:Connect(function(...)
		PromptUI.Enabled = false

		if Character and Character:IsDescendantOf(workspace) then
			CF = Character:GetPivot(...)
		end

		TriggerEnded = ProximityPrompt.TriggerEnded:Connect(function(...)
			TriggerEnded:Disconnect(...)
			PromptUI.Enabled = true
		end)
	end)

	HoldBegan = ProximityPrompt.PromptButtonHoldBegan:Connect(function(a, b, c)
		local Progress = PromptUI.Frame.Progress
		Progress.Visible = true
		Progress.UIScale.Scale = 0

		Core:Tween(Progress.UIScale, TweenInfo.new(ProximityPrompt.HoldDuration), {Scale = 1})

		HoldEnded = ProximityPrompt.PromptButtonHoldEnded:Connect(function(...)
			Core:Disconnect({HoldEnded})
			Progress.Visible = false
			Progress.UIScale.Scale = 0
		end)
	end)

	Mouse1Down = PromptUI.TextButton.MouseButton1Down:Connect(function(...)
		ProximityPrompt:InputHoldBegin()
		Mouse1Up = PromptUI.TextButton.MouseButton1Up:Connect(function(...)
			Mouse1Up:Disconnect(...)
			ProximityPrompt:InputHoldEnd()
		end)
	end)

	ProximityPrompt.PromptHidden:Wait(...)

	PromptUI:Destroy(...)

	Core:Disconnect({Mouse1Down, Mouse1Up, HoldBegan, HoldEnded, Triggered, TriggerEnded})
end

--||--||--||


Character = Player.Character or Player.CharacterAdded:Wait()
Humanoid = Character:WaitForChild('Humanoid', 1)


Player.CharacterAdded:Connect(function(CharacterAdded : Model, ...)
	Character = CharacterAdded
	Humanoid = Character:WaitForChild('Humanoid', 1)
end)


ProximityPromptService.PromptShown:Connect(function(ProximityPrompt, InputType, ...)
	if ProximityPrompt.Style == Enum.ProximityPromptStyle.Custom then
		local ScreenGui = Core:ScreenGui(...)
		Core:CreatePrompt(ProximityPrompt, InputType, ScreenGui, ...)
	end
end)

--||--||--||

return Core

try this code for error!