Tweening GUI Issue

Hi there,

An issue unknown to me has arisen in what I thought would be a simple process. When activating a ProximityPrompt, my GUI appears normal. However, when attempting to activate the ProximityPrompt a second time, the GUI doesn’t appear.

Here is a link to a video illustrating the problem:

Note the position of the Frame in the Output.

Here are my scripts

Activating via ServerScript:

script.Parent.Triggered:Connect(function(Player)
	local Note = Player.PlayerGui.MysteriousNote.Frame
	Note:TweenPosition(
		UDim2.new(0.5, 0, 0.5, 0),
		"Out", 
		"Sine", 
		0.75,
		true
	)
	print(Note.Position)
end)

Closing via LocalScript:

local Note = script.Parent
local DiscardNote = Note.CloseNote

DiscardNote.MouseButton1Up:Connect(function()
	Note:TweenPosition(
		UDim2.new(0.5, 0, 1.5, 0),
		"In",
		"Sine",
		0.5,
		true
	)
	print(Note.Position)	
end)

Use RemoteEvents.

On the Server, if the ProximityPrompt was activated, it returns a Player instance via Triggered:Connect(function(player)). Server then FireClient()'s the Player.

The LocalScript should then respond with showing the page through the RemoteEvent’s event OnClientEvent.

If you want every player to see it (which would be annoying) the player return from ProximityPrompt is not necessary, and you can just call FireAllClients().

developer.roblox.com/en-us/api-reference/class/ProximityPrompt

1 Like

You are activating with the server but closing with the client, things on the client do NOT appear on the server, you MUST open and close with server / client (one side ONLY)

1 Like

That’s a bit hard to visualise.

Are you able to provide the answer via a script?

Setup (relative to Game) [You may use your current names for instances instead of what was provided here]:

ServerScriptService
	└ ServerScript (Script)
ReplicatedStorage
	└ OnNoteActivate (RemoteEvent)
ReplicatedFirst
	└ NoteDisplay (LocalScript)
StarterGui
	└ NoteGui (ScreenGui + Other GuiBase2d)

ServerScript:

local Replicated_Storage = game:GetService("ReplicatedStorage")
local On_Note_Activate = Replicated_Storage:FindFirstChild("OnNoteActivate")
local Prompt -- Wherever your prompt is, put it here.

Prompt.Triggered:Connect(function(Player)
	On_Note_Activate:FireClient(Player)
	
	-- If you need all clients to see...
	-- On_Note_Activate:FireAllClients()
end)

NoteDisplay:

local Replicated_Storage = game:GetService("ReplicatedStorage")
local On_Note_Activate = Replicated_Storage:WaitForChild("OnNoteActivate")
local Note_Gui -- Path to GUI (NOT StarterGui)

On_Note_Activate.OnClientEvent:Connect(function()
	-- your GUI logic
end)

NoteGui.PutYourButtonsPathHere.MouseButton1Click:Connect(function()
	-- Hide note.
end)

None of the code is tested, although this should work.

1 Like

Unfortunately, it doesn’t work.

The ProximityPrompter is able to display. However, the position of the frame fails to change. There is no error illustrated in the output, which is annoying.

How is your code set up now? Have you tried adding a print call to the functions in the server and local scripts?

ServerScript (Parented to SSS):

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local PromptNote = ReplicatedStorage:FindFirstChild("PromptNote")
local Prompt = game.Workspace.DiscardedNote.Prompter.ProximityPrompt

Prompt.Triggered:Connect(function(Player)
	PromptNote:FireClient(Player)
end)

LocalScript (Parented to ReplicatedFirst):

local StarterGui = game:GetService("StarterGui")
local Note = StarterGui:WaitForChild("Note")
local NoteFrame = Note:WaitForChild("Frame")

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local PromptNote = ReplicatedStorage:FindFirstChild("PromptNote")
local Prompt = game.Workspace.DiscardedNote:WaitForChild("Prompter"):WaitForChild("ProximityPrompt")

PromptNote.OnClientEvent:Connect(function()
	NoteFrame:TweenPosition(
		UDim2.new(0.5, 0, 0.5, 0),
		"Out", 
		"Sine", 
		0.75,
		true
	)
end)

NoteFrame.CloseNote.MouseButton1Click:Connect(function()
	NoteFrame:TweenPosition(
		UDim2.new(0.5, 0, 1.5, 0),
		"In",
		"Sine",
		0.5,
		true
	)
end)

Creating print statements results in this information:
{0.5, 0}, {1.5, 0} - Client - DisplayNote:17
{0.5, 0}, {0.5, 0} - Client - DisplayNote:17

So it seems that the frame is tweening successfully but isn’t displaying (ScreenGUI is enabled btw). Odd

You are animating the GUI in the StarterGui. Players have a separate container PlayerGui, where all 2D elements can be manipulated. StarterGui’s use is to provide the main interface to Player’s PlayerGui after joining in or respawning (if ScreenGui.ResetOnSpawn is true).

I’ve stated this in the sample code:

NoteDisplay, line 3:
local Note_Gui -- Path to GUI >> (NOT StarterGui) <<
1 Like

My mistake.

Thanks for pointing that out.

1 Like