Tween gui with Proximity prompt and Close Button

Hey! I would like to make a Gui that activates with proximity prompt and with a tween effect but that it has a button to close it and that leaves with a tween effect I also always find tutorials that only activate the tween and after a few seconds it goes away, but not one that it goes away by pressing a button. Your help would be very useful!! :C

RemoteEvent - ReplicatedStorage
Script - workspace>Part>ProximityPrompt
LocalScript - StarterGui>ScreenGui>Frame
LocalScript2 - StaterGui>ScreenGui>Frame>TextButton

Script
local RemoteEvent = game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent")

local ProximityPrompt = script.Parent

local debounce = false

ProximityPrompt.Triggered:Connect(function()
        if debounce == false then
                debounce = true
                RemoteEvent:FireClient()
        else
                debounce = false
        end
end)
LocalScript
local RemoteEvent = game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent")

local Frame = script.Parent

RemoteEvent.OnClientEvent:Connect(function()
        Frame:TweenPosition(
                UDim2.new(0.45, 0, 0.423, 0),
                "Out", -- Select EasingDirection *1
                "Quad", -- Select EasingStyle *1
                1, -- Time (Seconds)
                false

)
end)
LocalScript2
local TextButton = script.Parent

TextButton.MouseButton1Up:Connect(function()
        Frame:TweenPosition(
                UDim2.new(0.4, 0, 0.998, 0),
                "In", -- Select EasingDirection *1
                "Quad", -- Select EasingStyle *1
                1, -- Time (Seconds)
                false

)
end)

*1
Easingstyle


https://create.roblox.com/docs/building-and-visuals/ui/ui-animations

1 Like

WOW, Thanks but it gives me an error in Localscript2 I don’t know much about scripting so I don’t know what to do here help pls :frowning:
image
Say Unknow Local ‘‘Frame’’ :C

1 Like

BTW: You can edit the UI as you like, you can add any instance inside the frame. (TextLabel, TextButtons, ImageLabel, etc.)

Try this.

local TextButton = script.Parent
local Frame = TextButton.Parent

TextButton.MouseButton1Up:Connect(function()
        Frame:TweenPosition(
                UDim2.new(0.4, 0, 0.998, 0),
                "In", -- Select EasingDirection *1
                "Quad", -- Select EasingStyle *1
                1, -- Time (Seconds)
                false

)
end)
1 Like

Thank you :smiley: but something happened… apparently I tried to test this but nothing happened… not if I did something wrong but it just doesn’t work :frowning:

is there any errors? can you show us ur explorer?

image
This is How Proximity Prompt Look

image
ScreenGui:

image
RemoteEvent:

literally didn’t change anything lol but still not working :frowning:

send some screenshots and a video

he made an error in the Script inside of the proximityprompt

change it to this:

local RemoteEvent = game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent")

local ProximityPrompt = script.Parent

local debounce = false

ProximityPrompt.Triggered:Connect(function(player)
        if debounce == false then
                debounce = true
                RemoteEvent:FireClient(player)
        else
                debounce = false
        end
end)

hopefully it works :grin:

1 Like

It didn’t work either…I don’t know what’s going on, I have everything in its place and it still doesn’t work :frowning:

image
the LocalScript at the top is in the wrong place, it should be inside of Frame

you should also turn on your Output whenever you script as it tells you exactly what the error is:
image

3 Likes

OOPS I’m an airhead :stuck_out_tongue: I had made a mistake but now it works :smiley: THANK YOU VERY MUCH!!!

1 Like

Result:


Thank you both for helping me :,D

2 Likes