Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How Can I Make A Gui PopUp When I Interact With A ProximityPrompt ?

Hello !

I Am Trying To Make A Door That When Interacted With Will Make It Open Then Display A Gui That Asks The Player If They Are Sure If They Want To Be Teleported To A Location , If They Accept , They Will Be Teleported And The Door Will Close, If They Refuse The Door Will Just Close . But I Cant Find Any Script That Will Allow Me To Do That And I Thought Someone Might Be Able To Help Me Here ...

This Is The Door Script

local TweenService = game:GetService("TweenService")
local door = script.Parent
local doorHinge = door.PrimaryPart
local doorOpen = TweenInfo.new()

local doorCFrame = TweenService:Create(doorHinge, doorOpen, {
	CFrame = doorHinge.CFrame * CFrame.Angles(0, math.rad(-100),0)
})

local doorCFrameClosed = TweenService:Create(doorHinge, doorOpen, {
	CFrame = doorHinge.CFrame * CFrame.Angles(0, math.rad(0),0)
})

local ProximityPrompt = script.Parent.ProximityPrompt
local PromptVanish = ProximityPrompt.Enabled == false
local PromptAppear = ProximityPrompt.Enabled == true

ProximityPrompt.Triggered:Connect(function()
	doorCFrame:Play()
	script.Parent.Open:Play()
	ProximityPrompt.Enabled = false
	wait(3)
	doorCFrameClosed:Play()
	script.Parent.Close:Play()
	ProximityPrompt.Enabled = true
	wait(1)

end)


This Is The Layout Of The Door

Click Me (Gyazo Link)

1 answer

✓ Accepted answer

ProximityPrompt.Triggered has a parameter which is the player that triggered the prompt.

ProximityPrompt.Triggered:Connect(function(playerThatTriggeredThePrompt)
   print(playerThatTriggeredThePrompt.Name)
end)

Yeah, I know that I just named the parameter long you could just change it to "client" or to whatever you want.

So now you could get the PlayerGui with the parameter.

ProximityPrompt.Triggered:Connect(function(client)
   local playerGui = client.PlayerGui
   local screenGui = playerGui.ScreenGui
end)

So you'd just have to make a GUI and parent it to StarterGui. And enable and disable the property of the ScreenGui.

This discussion is preserved as it was. New answers, comments, and votes are closed.