Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How can I properly fix this "round prompt" script?

Asked by
3F1VE 257 Moderation Voter
2 years ago

The script edits the default UICorner of the prompt to make it round. The problem is it only works once then it doesnt work the next time. Here is the script :

local ProximityPromptService = game:GetService("ProximityPromptService")
local Players = game:GetService("Players")

local LocalPlayer = Players.LocalPlayer
local PlayerGui = LocalPlayer:WaitForChild("PlayerGui")

local function getScreenGui()
    local screenGui = PlayerGui:FindFirstChild("ProximityPrompts")
    if screenGui == nil then
        screenGui = Instance.new("ScreenGui")
        screenGui.Name = "ProximityPrompts"
        screenGui.ResetOnSpawn = false
        screenGui.Parent = PlayerGui
    end
    return screenGui
end

local function onPromptShown()
    for index, prompt2 in pairs(getScreenGui():GetChildren()) do
        local Frame = prompt2:WaitForChild("Frame")
        Frame:WaitForChild("UICorner").CornerRadius = UDim.new(1, 0)
    end
end

ProximityPromptService.PromptShown:Connect(onPromptShown)

Any help would be appreciated.

Answer this question