This system was supposed to print a value's name, but it prints nil. I'm 100% I didn't misspell anything, and I'm very confused why it's printing nil.

-- local script
script.Parent.MouseButton1Down:Connect(function()
remote:FireServer(game.Players.LocalPlayer.OwnedCars.PurchasedChryslerMEFourTwelve)
end)
--server script
game.ReplicatedStorage.CarBuying.ChangeCash.OnServerEvent:Connect(function(player,purchasedValue)
	print(purchasedValue.Name)
end)

Edit: lol, In the locascript I fired the right remote, but in the server script I made the event of another remote, and not the one that I fired. That's why it said that it was nil, because I didn't fire the remote that was on the serverscript.

7 comments

0

Could it be because you put player ,purchasedValue - The space in the wrong spot? Let me know of this was ot and if it was i will post an answer on it.

0

Sorry for bad spelling - on mobile

0

No, the first argument for .OnServerEvent is always the player that fired it, then the arguments passed by :FireServer().

0

Okay.

0
0

How? Did you copy the script properly?

0

you are sending an instance over by remote* the server has to know it exists, since it probably doesnt just fire the name on line 3 instead of the instance