`PlayerGui` is not valid member of player

Are you letting them load by any chance? Or are you just doing this when they join?

how would i make it see? using remove events? and if yes then how?

In Test Mode look at your Player.

You will see that you can only see your own PlayerGui.

Screen Shot 2024-03-26 at 3.57.03 PM

Only Server Scripts can access everyone’s PlayerGui.

1 Like

No, haha. You can not do that.

But, he mentioned that it was an error in the server output, meaning it is a server script??

You can access everyone’s gui with a ServerScript.

i know but how would i make it? using remote events? and if yes then how would i make that?

I don’t know the details of what you are doing.

Is there some reason you need to use a LocalScript?

yes, i need to use this as local script because the code that i showed you was only small part of the real script. and when i convert it to script its all just doesn’t work

So, you are trying to pick up the name of a Barista and give them points that will show up in the Barista’s gui?

Correct?

yes, but it won’t show up in barista’s gui its in leaderboard but apparently yes

Here is a quick example of how to do it using a RemoteEvent on ReplicatedStorage:

LOCAL SCRIPT:

local RS = game:GetService("ReplicatedStorage")
local RemoteEvent = RS:WaitForChild("RemoteEvent")

function onYes()	
	
	-- find barista name
	
	if Players:FindFirstChild(script.Parent.Parent.barista.Value) then -- it is a player
		
		-- send barista name to server
		
		RemoteEvent:FireServer(script.Parent.Parent.barista.Value)
		
		-- remove item
		
		script.Parent:TweenPosition(UDim2.new(0.5, -200,0,-121))
		wait(1)
		script.Parent:Destroy()
	end
end

SERVER SCRIPT:

local Players = game:GetService("Players")
local RS = game:GetService("ReplicatedStorage")
local RemoteEvent = RS:WaitForChild("RemoteEvent")

RemoteEvent.OnServerEvent:Connect(function(player, barista)
	
	-- need some kind of sanity check
	-- need to make sure barista should/can receive the points
	-- otherwise a hacker with an alt account can just join with both accounts and send themselves infinite points
	-- or, they might just start sending everyone tons of points
	-- need to figure out what the sanity check is
	
	if Players:FindFirstChild(barista) then
		
		-- saniy check here
		
		Players[barista].leaderstats.Points.Value = Players[barista],leaderstats.Points.Value + 1
		
	end

end)

I’m sure the script above is not perfect, but it should help you get going.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.