Hello I’m trying to use Streaming Enabled rendering system , but I met an issue with Proximity Prompt Handler: I set the streaming using 350 minRad and 420 MaxRad and Opportunistic. So the issue is that when I go out the area , and return in it , the proximity prompts broke, in fact the custom GUI that technically sostitute the normal prompt, flickers. Can anyone help me ?
--// Services
local ProximityPromptService = game:GetService("ProximityPromptService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local UserInputService = game:GetService("UserInputService")
local RunService = game:GetService("RunService")
local Players = game:GetService("Players")
local specW = {"TM11"}
--// Modules
--// Assets
local Player = Players.LocalPlayer
local EnterPromptGUI = script:WaitForChild("VehicleSeatButtonBill")
--// Settings
local EnterPrompt_Radius = 5
local EnterPrompt_KeyBind = Enum.KeyCode.E
local EnterPrompt_GamepadBing = Enum.KeyCode.ButtonX
--// Variables
local RegisteredProximities: {ProximityPrompt} = {}
local Seated = false
local CurrentShownPrompt: ProximityPrompt?
--// Auxiliary Functions
--// Main Functions
local function InitProximityPrompt(ProximityPrompt: ProximityPrompt)
local Attachment = ProximityPrompt.Parent :: Attachment
if not (Attachment.Name == "EnterPrompt" and Attachment:IsA("Attachment")) then return end
if table.find(RegisteredProximities, ProximityPrompt) then return end
table.insert(RegisteredProximities, ProximityPrompt)
ProximityPrompt.MaxActivationDistance = EnterPrompt_Radius
ProximityPrompt.KeyboardKeyCode = EnterPrompt_KeyBind
ProximityPrompt.GamepadKeyCode = EnterPrompt_GamepadBing
ProximityPrompt.RequiresLineOfSight = false
ProximityPrompt.Style = Enum.ProximityPromptStyle.Custom
end
local function TriggerPrompt(prompt)
if table.find(RegisteredProximities, prompt) then
if CurrentShownPrompt then
prompt.Parent.Parent.VehicleSeatEvent:FireServer()
end
end
end
--// Main Code
EnterPromptGUI.Parent = Player.PlayerGui
EnterPromptGUI.TextButton.MouseButton1Click:Connect(function()
if CurrentShownPrompt and Player.Character.Humanoid.Sit == false then
EnterPromptGUI.TextButton:TweenSize(UDim2.new(0,80,0,80), Enum.EasingDirection.Out, Enum.EasingStyle.Bounce,0.05, false)
wait(0.1)
EnterPromptGUI.TextButton:TweenSize(UDim2.new(0,70,0,70), Enum.EasingDirection.Out, Enum.EasingStyle.Bounce,0.05, false)
EnterPromptGUI.Sound:Play()
TriggerPrompt(CurrentShownPrompt)
end
end)
for _,v in ipairs(workspace:GetDescendants()) do
if v:IsA("ProximityPrompt") then
InitProximityPrompt(v)
end
end
workspace.DescendantAdded:Connect(function(descendant)
if descendant:IsA("ProximityPrompt") then
InitProximityPrompt(descendant)
end
end)
ProximityPromptService.PromptShown:Connect(function(prompt)
CurrentShownPrompt = prompt
if table.find(RegisteredProximities, prompt) and not Seated then
EnterPromptGUI.Adornee = prompt:FindFirstAncestorWhichIsA("BasePart")
if prompt:FindFirstChild("StringValue").Value == "Interact" then
EnterPromptGUI.Text.Text = "INTERACT" --"E to Interact"
end
if prompt:FindFirstChild("StringValue").Value == "Sit" then
EnterPromptGUI.Text.Text = "SIT"
end
if prompt:FindFirstChild("StringValue").Value == "Use" then
EnterPromptGUI.Text.Text = "USE"
end
if prompt:FindFirstChild("StringValue").Value == "Open" then
EnterPromptGUI.Text.Text = "OPEN"
end
EnterPromptGUI.StudsOffsetWorldSpace = prompt.Parent.Position
EnterPromptGUI.Enabled = true
end
end)
ProximityPromptService.PromptHidden:Connect(function(prompt)
CurrentShownPrompt = nil
if table.find(RegisteredProximities, prompt) then
EnterPromptGUI.Enabled = false
end
end)
--local promptTriggered : boolean = false :: boolean
ProximityPromptService.PromptTriggered:Connect(function()
if CurrentShownPrompt and Player.Character.Humanoid.Sit == false then
-- if (promptTriggered :: boolean) then
EnterPromptGUI.TextButton:TweenSize(UDim2.new(0,80,0,80), Enum.EasingDirection.Out, Enum.EasingStyle.Bounce,0.05, false)
wait(0.1)
EnterPromptGUI.TextButton:TweenSize(UDim2.new(0,70,0,70), Enum.EasingDirection.Out, Enum.EasingStyle.Bounce,0.05, false)
EnterPromptGUI.Sound:Play()
TriggerPrompt(CurrentShownPrompt)
--end
-- promptTriggered = true :: boolean
end
end)
Player.CharacterAdded:Connect(function(character)
local Humanoid: Humanoid = character:WaitForChild("Humanoid")
Seated = false
Humanoid.Seated:Connect(function(active, seatPart)
if active then
EnterPromptGUI.Enabled = false
else
if CurrentShownPrompt then
EnterPromptGUI.Enabled = true
end
end
Seated = active
end)
end)