Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Workspace.Script:6: attempt to index local 'Price' (a nil value)?

Asked by 5 years ago

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)
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. OBenjOne 190 — 5y
0
Sorry. It's Line 1. LordBlueSky 10 — 5y
1
Ok OBenjOne 190 — 5y
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? LordBlueSky 10 — 5y
View all comments (2 more)
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. saenae 318 — 5y
0
I solved the problem, but what remains now is actually saving the item upon purchasing so when the player rejoins, they get it. LordBlueSky 10 — 5y

Answer this question