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

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

Asked by
Split_s 21
3 years ago

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

Log in to vote
0
Answered by 3 years ago
Edited 3 years ago

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.

Ad

Answer this question