It says NoOfItems is a nil value? Btw this is Tuneable's placement script but changed to fit my game
local script:
local function initiatePlacement(itemName) script.Parent.HitboxHandler.Disabled = true placementEnabled = true NoOfItems = player.PlayerItems:FindFirstChild(itemName) game:GetService("UserInputService").InputBegan:connect(function(input) if input.KeyCode == Enum.KeyCode.X then cancelPlacement() end end) if NoOfItems.Value <= 0 then cancelPlacement() player.PlayerItems.PreviousItem.Value = '' end cancelPlacement() dummyModel = GameItems[itemName]:Clone() currentItemName = itemName for _, object in pairs(dummyModel:GetChildren()) do if (object:IsA("BasePart")) then object.CanCollide = false end end dummyModel.Parent = workspace local signal = plane:enable(dummyModel) signal:connect(function(location, _) game:GetService("ReplicatedStorage").PlaceItem:FireServer(currentItemName, location) player.PlayerItems.PreviousItem.Value = itemName if NoOfItems.Value <= 0 then cancelPlacement() end end) end game:GetService("ReplicatedStorage").MoveItem.OnClientEvent:connect(function(player) print('Recieved') print(game.Players.LocalPlayer.PlayerItems.PreviousItem.Value) initiatePlacement(GameItems:FindFirstChild(game.Players.LocalPlayer.PlayerItems.PreviousItem.Value)) end)
PlayerItems is a folder with a list of number values each value has a different name PreviousItem is string value
Output:
Recieved BasicFurnace 16:50:46.975 - Players.therealae.PlayerGui.TestGui.ClientPlacement:46: attempt to index upvalue 'NoOfItems' (a nil value) 16:50:46.975 - Stack Begin 16:50:46.983 - Script 'Players.therealae.PlayerGui.TestGui.ClientPlacement', Line 12 - upvalue initiatePlacement 16:50:46.984 - Script 'Players.therealae.PlayerGui.TestGui.ClientPlacement', Line 38 16:50:46.985 - Stack End
It states as nil because there is no such directory called
player.PlayerItems:FindFirstChild(itemName)
What you want is
player.Backpack:FindFirstChild(itemName)
If this solved your problem, please mark as the solution!
As always, good scripting!