Not a valid member of player

i’m having an issue in which the console says "buyer is not a valid member of Player “Players.VirxtraAlt”
when it obviously is inside when i check in the workspace
any solution?

1 Like

Hello. The problem is model is not actual player, but you put buyer value in model.
Solution: change your script to make it work for model or player.
If you want me to, I can do script for you to put it in player.

Alright, I edited it multiple times but this is the correct one.

do: Players.VirxtraAlt.Character.Buyer

Was that image you sent taken while in testing or in normal studio?
Also, can you show us your whole script to make it easier to help you?

So you haven’t really given us enough information to figure out what the problem may be. If we have more details we can help you much better. There are a few problems there could be:

You may be indexing the instance before it’s loaded in, in which case you should instead write

local buyer = Players.VirxtraAlt:WaitForChild(“buyer”, 10)
if not buyer then print(“fatal error, buyer nil”) return end

10 seconds of waiting is ample time for an instance that should have been there instantly. This would also be assuming the player is 100% loaded in.

Another error could be that you are referencing StarterPlayer when you mean to reference Players. In this case you’d need to update the definition of players to


This was taken while testing in studio.

	local buyer = plr.buyer
	if buyer.Value == false then
		buyer.Value = true
		if plr.leaderstats.Token.Value >= script.Parent.Value.Value then
		plr.leaderstats.Token.Value -= script.Parent.Value.Value
	script.Parent.Parent["Buy house system"].an.SurfaceGui.SIGN.Text = plr.Name
		script.Parent.Parent["Buy house system"].an.SurfaceGui.SIGN.TextColor = plr.TeamColor
		script.Parent.Parent["Buy house system"].a.SurfaceGui.SIGN.Text = "Press G to sell this house."
		script.Parent.Parent["Buy house system"].a.SurfaceGui.SIGN.TextColor ="Deep orange")
			script.Parent.Parent["Buy house system"].w.SurfaceGui.SIGN.Visible = false
			script.Parent.Parent["Buy house system"].Value.Value = plr.Name
			script.Parent.BUYABLE.Value = false

The part about the buyer thing is at the start.

To prove that buyer really does exist during runtime, please do two things:

Firstly, run the simulation and find the buyer instance in explorer

Two, explain whether this Player object your referencing is actually the player, or a model representing it.

Hm, it exists during runtime. Though, the output still comes out the same whether or not I put it in StarterPlayerScripts and StarterCharacterScripts. When I change the script to plr.PlayerScripts.Buyer, it in turn says PlayerScripts is not a valid member of the player

, when it is in explorer. Also, the script is referencing the actual player.

When you run the game, are you making sure to switch to Server to see if it exists on the server as well? Also are you inserting buyer into StarterPlayerScripts manually in Studio, or through a LocalScript?

Buyer is inserted manually in StarterPlayerScripts before testing. And just realised, buyer does not exist in Server.

Okay so basically you can’t see PlayerScripts from the server and therefore you can’t put buyer there and expect it to appear on the server(at least from what I can tell when I testrun my game). The following solution isn’t hacky since it uses intended behaviors.

Step 1: Insert the buyer object into StarterCharacterScripts instead

Step 2: In the script, define the Character:

local character = player.Character or player.CharacterAdded:Wait()

Step 3: define the buyer and move it where it should be

local buyer = character:WaitForChild("buyer", 10)
if player:FindFirstChild("buyer") then 
	buyer.Parent = player

This should hopefully resolve the issue.


local buyer = character:WaitForChild("buyer", 10)
if player:FindFirstChild("buyer") then 
	buyer = player.buyer
	buyer.Parent = player

Thank you so much! This resolved my problem and the script is working as it should!

1 Like

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