I made this placement system but it will not work.
LocalScript Inside of StarterPack:
local Player = game.Players.LocalPlayer
local Base = Player:WaitForChild("base")
local Money = Player:WaitForChild("Money")
local UIS = game:GetService("UserInputService")
local Mouse = Player:GetMouse()
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Items = ReplicatedStorage.Items
local PlaceItem = ReplicatedStorage.PlaceItem
local ItemTable = {}
local PlacingItem = {}
for i,v in pairs(Items:GetChildren()) do
table.insert(ItemTable,v)
end
function GetPlacingItem()
for i,v in pairs(PlacingItem) do
return v.Name
end
end
UIS.InputBegan:Connect(function(Key,GPE)
if Key.KeyCode == Enum.KeyCode.E and not GPE then
local index = math.random(1,#ItemTable)
table.insert(PlacingItem,ItemTable[index])
-- local RealItem = Items[GetPlacingItem()]:Clone()
if Mouse.Target == Base.Value then
PlaceItem:InvokeServer(PlacingItem,true)
end
end
end)
Script Inside of ServerScriptService:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local PlaceItem = ReplicatedStorage.PlaceItem
function PlaceItem.OnServerInvoke(Player,Item,MouseOnBase)
if MouseOnBase then
local Mouse = Player:GetMouse()
Mouse.Move:Connect(function()
for i,v in pairs(Item) do
local RealItem = ReplicatedStorage.Items[v.Name]:Clone()
RealItem.Parent = game.Workspace.CurrentCamera
RealItem:SetPrimaryPartCFrame(Mouse.Hit.p)
end
end)
end
end
Error:
12:29:20.244 - ServerScriptService.Data.PlaceMent:6: bad argument #2 to '?' (string expected, got Object) 12:29:20.245 - Stack Begin 12:29:20.246 - Script 'ServerScriptService.Data.PlaceMent', Line 6 12:29:20.246 - Stack End 12:29:20.247 - ServerScriptService.Data.PlaceMent:6: bad argument #2 to '?' (string expected, got Object) 12:29:20.248 - Stack Begin 12:29:20.249 - Script 'Players.FuriaI.Backpack.Placement', Line 28 12:29:20.249 - Stack End

1 comment
Thank you.