How do I make UI that is visible to two players?

What am I trying to achieve?
Basically when people press E and come to the stage for a match I want to show them the UI, but I have issues with it. I don’t know how to fire the remote event for two players

What did I try so far?
Searched YouTube tutorials, looked at the Developer Hub.

By the way if you’re wondering here’s the code I wrote until now:

ServerScript:
local ReplicatedStorage = game:GetService(“ReplicatedStorage”)

local RemoteEvent = ReplicatedStorage:WaitForChild(“RemoteEvent”)

local GameUI = game.StarterGui.GameUI

RemoteEvent.OnServerEvent:Connect(function(player)

GameUI.Enabled = true

end)
LocalScript:
local ReplicatedStorage = game:GetService(“ReplicatedStorage”)

local RemoteEvent = ReplicatedStorage:WaitForChild(“RemoteEvent”)

local Spawn1 = ReplicatedStorage.StageSpawn1

local Spawn2 = ReplicatedStorage.StageSpawn2

local User1 = ReplicatedStorage.Users.User

local User2 = ReplicatedStorage.Users.User1

local function checkSpawnPoints(player)

if Spawn1 and Spawn2 == true then

RemoteEvent:FireServer(User1, User2)

end

end

if true then

checkSpawnPoints()

end

I’m pretty sure you can use remote functions to achieve this. Bindable Events and Functions | Documentation - Roblox Creator Hub
using UIS you can check individually for each player if they click E, and when they do, you invoke the server and then the server sends back to the specified players instructions, and the players open their UIs.

I used proximity prompts in order to see if they triggered it or not, will that still work?

Im not familiar with them, but they definitely should work if you can implement the idea

Okay, thanks! I’ll be looking into it soon!

1 Like

For future reference, put ~~~ before and after your code to make it easier to read, or there is another kind of symbol as an alternative, but I am on a mobile device so I can’t show it.

Okay, thanks for the trick by the way. I really need to plan out my code before writing it.