How can I tween GUIs with Proximity Prompts

Hello. I want to make a GUI tween using Proximity Prompts for a shop. I want it so when the Proximity Prompt finished, it will tween the GUI to the screen and able to go to the shop and do it again when the player is finished.

I used this script in the proximity prompt.

local prompt = script.Parent

local open = false -- debounce lol

prompt.Triggered:Connect(function(player)
	local playerGui = player:WaitForChild("PlayerGUI")
	local screenGui = playerGui.Shop
	local frame = screenGui.Gradient
	
	if open == false then
		open = true
		frame:TweenPosition(UDim2.new(0.178, 0, 0.108, 0))
	else
		open = false
		frame:TweenPosition(UDim2.new(0.178, 0, 1, 0))
	end
	
end)

I also have a local script in the GUI that closes it (X), but it works.

I used this tutorial

1 Like

You forgot to get the ProximityPromptService

local ProximityPromptService = game:GetService("ProximityPromptService")
2 Likes

image
By the way this is the error (I am pretty sure)
and the EmojiChatController had to be there, thats not the error.

You also forgot to get the TweenService

local TweenService = game:GetService("TweenService")

Also it should be -

local playerGui = player:WaitForChild("PlayerGui")

and not

local playerGui = player:WaitForChild("PlayerGUI")

You can refer to this on how to tween Gui Object’s position

Hope it helps

I found it, its the PlayerGui being wrong. Thanks :+1: s