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:
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().
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)
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.
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.
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)
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) <<