How can i make a tool that opens a gui for another player?

Yeah, so the title is really Explanatory please If you can help me that would be great thank you!

Thee code for the tool would be
script.Parent.Activated:connect(function()
local gui = game.StarterGui.Gui – or what ur gui name is
gui.Enabled = true
end

use remote event to fire all clients

Yeah but that would show it to me not them.

When you activate the tool (do this in a Server Script) fire a remote event to the specific player who’s GUI you wanna change something like : RemoteEvent:FireClient(player) , then receive it on a Local Script and change the gui.

Can u give me a an example as a script please.

Tool.Activated:Connect(function()
   RemoteEvent:FireClient(player) -- replace player variable with the specific player , idk how you got it
end)
RemoteEvent.OnClientEvent:Connect(function()
   GUI.Enabled = true -- Idk your reference to the Gui , this is an example piece of line.
end)

Yeah, but i dont want it to be a specific player i want to be to any player thats around me do u get me?

Well loop through all players and get all those player’s Distance from you and check who is the closet player and fire the remote event to that player , this can be done easily by you using for loop , GetPlayers function, Magnitude and some logic.

I need help with that can u help me?

I explained how to do it well , you can try it yourself ! Use some logic!

Alr thank you for your explanations!

If it helped you , please mark my answers as solution.

local Players = game:GetService("Players")

for _, plr in ipairs(Players:GetPlayers()) do
  local char = plr.Character
  if not char then continue end
  
  local hrp = char:FindFirstChild("HumanoidRootPart")
  if not hrp then continue end

  if (hrp.Position - myHRP.Position).Magnitude < someRadius then
    -- activate their GUI
  end
end

Spoon feeding isn’t a good way to teach others.

I understand this, thus not giving the entire solution. Thanks for the advice, though.

aye yo thank you, this goes on a local script inside the tool right?

You can do it in a server script so that you can use FireClient in that script .

Precisely. @MON_STER0, perhaps you should read up about Remote Functions and Events.