NumberValue Is not a valid Member Of Player? But It's Not A Player Its A NumberValue

Yes I Have 2 Topic’s A Day But I dont seem why it is not allowed as i have done this before

I Have Been Working On This For 4 Hours And I Might Just Give Up

is there any chance that this script reads the player instead of the Class NumberValue

Server Code

game.ReplicatedStorage.ChangeTrail.OnServerEvent:Connect(function(plr, NumberValue, number)
	if plr then
		if NumberValue and number then
			NumberValue.Value = number
			return NumberValue
		end
	end
end)

Client Sample Code


local plr = game.Players.LocalPlayer
script.Parent.MouseButton1Click:Connect(function()
	game.ReplicatedStorage.ChangeTrail:FireServer(plr,plr.TrailColor,6)
end)

Error

21:21:25.828 - Value is not a valid member of Player
21:21:25.830 - Stack Begin
21:21:25.832 - Script 'ServerScriptService.Receive', Line 4
21:21:25.836 - Stack End

OnServerEvent provides the player who fired it, followed by all of the arguments you gave to FireServer, which means your function is getting the arguments Player, Player, NumberValue, 6.

Get rid of plr, as the first argument given to FireServer.

4 Likes

i got this from another topic thank you for answering ill make it as the solution