I get this error:
1 | Workspace.SellPlatform.SellScript: 29 : attempt to index a nil value |
For this script:
01 | -- When a player touches the parent object, their items will be sold for gold |
02 | local sellPart = script.Parent |
03 |
04 | -- Gives the player gold for each item they have |
05 | local function sellItems(playerItems, playerGold) |
06 | -- Gives players 100 pieces of gold for each item |
07 | local totalSell = (playerItems.Value * 100 ) |
08 | playerGold.Value = playerGold.Value + totalSell |
09 | playerItems.Value = 0 |
10 | end |
11 |
12 | local function onTouch(partTouched) |
13 | -- Looks for a Humanoid |
14 | local character = partTouched.Parent |
15 | local humanoid = character:FindFirstChildWhichIsA( "Humanoid" ) |