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

How can I open a Gui with a ProximityPrompt? - Help!

Asked by 3 years ago

Hi Developers and Programmers, today I need your help. I have a problem, I want to change the function of opening the GUI with a ClickDetector. and put it to open with a ProximityPrompt, the script:

script.Parent.ClickDetector.MouseClick:Connect(function(plr)
        local newUI = script.CarSpawnUI:Clone()
        newUI.Parent = plr.PlayerGui
        newUI.MainFrame:FindFirstChild("LocalScript").Disabled = false
end)

If someone can give me the solution it would help me a lot. Thanks.

- ManuelCortesYT, SCS-Studios CEO

1 answer

Log in to vote
0
Answered by 3 years ago

For a ProximityPrompt you have to put "CarSpawnUI" disabled insert "StarterGui." With that you can do the following code.

local plr = nil
script.Parent.ProximityPrompt.Triggered:Connect(function(plrthattriggered)
plr = plrthattriggered
for i,player in pairs(game.Players:GetPlayers()) do
if player.Name == plr.Name thebn
player.PlayerGui.CarSpawnUI.Disabled = false
end
end)
0
Thank you so much! ManuelCortesYT -1 — 3y
Ad

Answer this question