I have used a script to clone a custom proximityprompt from replicatedStorage.
For some reason the prompt is not showing when hovering over a part with a proximityprompt in it.
The script seem to go through all the code, as the “cleanupFunction” recognizes that there is no prompt to clean up, creating an error confirming what is seen in-game.
local proxService = game:GetService("ProximityPromptService")
local players = game:GetService("Players")
local RS = game:GetService("ReplicatedStorage")
local localPlayer = players.LocalPlayer
local playerGui = localPlayer:WaitForChild("PlayerGui")
local custPrompt = RS:WaitForChild("Prompt")
local function getScreenGui()
end
local function createPrompt(promt, inputType, gui)
local promptUI = custPrompt:Clone()
promptUI.Adornee = promt.Parent
promptUI.Parent = gui
local function cleanupFunction()
promptUI.Parent = nil
end
return cleanupFunction()
end
proxService.PromptShown:Connect(function(promt, inputType)
if promt.Style == Enum.ProximityPromptStyle.Default then
return
end
local gui = getScreenGui()
local cleanupFunction = createPrompt(promt, inputType, gui)
promt.PromptHidden:Wait()
cleanupFunction()
end)
from my understandment, the nil error is caused by the prompt not being a child of the part with the proximity in it. When doing as you suggest, the error doesn’t even show, which would mean it doesn’t check for if the prompt is there (which would mean the code doesn’t run)
Your getScreenGui() function is supposed to return a Gui to parent your promptUI to, but it doesn’t return anything. This results in your promptUI getting parented to nil, instead of making it visible. You should finish your getScreenGui() function to fix it.