game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(player, item, price)
	if player.leaderstats.Coins.Value >= price.Value then
		player.leaderstats.Coins.Value = player.leaderstats.Coins.Value - price.Value
		local ItemClone = game.ServerStorage[item]:Clone()
		ItemClone.Parent = player.Backpack
		local ItemClone2 = game.ServerStorage[item]:Clone()
		ItemClone2.Parent = player.StarterGear
	end
end)


6 comments

0

Line 6? You don't even have price stated there. It must be line 3 or 1. If you put a number Value and a string Value together in a remote Event, it causes problems.  Try having the local script sending item and price print the price to see if it is really nil.

0

Sorry. It's Line 1.

1

Ok

0

Firstly, the price value is an IntValue, and also, it's key to know that this works in studio, but not in the client. I've followed your advice and told the script to print price if it works in STUDIO, and it did. Do you know the problem?

0

You may have already solved the problem, considering it's been 8 hours since you posed the question, but if you haven't, could you post the code where you fired the event? Not seeing anything wrong with what you've provided.

0

I solved the problem, but what remains now is actually saving the item upon purchasing so when the player rejoins, they get it.