I’m setting up custom prompt gui’s and noticed that if I change input type, it ends up clearing the old one and creating a completely new one?
Expected behavior
The UI should just adapt to the most recent input type. There’s no need to delete and recreate the entire UI just for a single image change.
1 Like
This seems to be an issue with how ProximityPromptService handles the PromptShown event. It triggers once again when, as you reported, changing input types.
local function onLoad()
ProximityPromptService.PromptShown:Connect(function(prompt, inputType)
print(inputType)
if prompt.Style == Enum.ProximityPromptStyle.Default then
return
end
local gui = getScreenGui()
local cleanupFunction = createPrompt(prompt, inputType, gui)
-- Wait for either the prompt being hidden or destroyed
local yield = Instance.new("BindableEvent")
local con = prompt.PromptHidden:Connect(function()
yield:Fire()
end)
local con2 = prompt.Destroying:Connect(function()
yield:Fire()
end)
yield.Event:Wait()
con:Disconnect()
con2:Disconnect()
cleanupFunction()
end)
end
onLoad()
Interestingly enough this also creates an unused-past-usage BindableEvent. Cumbersome!
3 Likes