I tried after getting some help with another script to get access to a player's playergui. I used a remote event, but it didn't work though.
I created a first local script where I wrote:
local players = game:GetService("Players")
local mouse = game.Players.LocalPlayer:GetMouse()
local event = game.ReplicatedStorage.RemoteEvent
mouse.KeyDown:connect(function(k)
k = k:lower()
if k == 'z' then
game.ReplicatedStorage.RemoteEvent:FireClient()
end
end)
Yes I know KeyDown is deprecated, please just help me. Here, I placed this local script where I Fire the Event in a ScreenGui in StarterGui.
-- Then I put another server script into ServerScriptService where I write:
local event = game.ReplicatedStorage.RemoteEvent
local players = game:GetService("Players")
local mouse = game.Players.LocalPlayers:GetMouse()
local event = game.ReplicatedStorage.RemoteEvent
event.OnServerEvent:Connect(function(plr)
local target = mouse.Target
local humanoid = target.Parent:FindFirstChild("Humanoid")
print("Hello")
if humanoid then
print("Humanoid trovato bae")
local character = humanoid.Parent
local nomeplayer = players:GetPlayerFromCharacter(character)
print(nomeplayer)
local playergui = nomeplayer:FindFirstChild("Playergui")
print(playergui)
end
end)
The error is in the first localscript, in "FireClient" line, and it gives me Argument 1 missing or nil. What should I write?

3 comments
At line 16 of the second Script, I noticed the error "Playergui" and that must be written "PlayerGui", and it still doesn't work.
where did you exactly put the local script?
In a screengui in Startergui.