Prints no errors
Part that places item:
local function iniciatePlacemnt(ItemNamee) if workspace:FindFirstChild(ItemNamee) then CancelPlacement() workspace[ItemNamee]:Destroy() end if PrevItem then if workspace:FindFirstChild(PrevItem) then CancelPlacement() workspace[PrevItem]:Destroy() end end -- CancelPlacement() script.Parent.Background.Visible = false local Item = Items:FindFirstChild(ItemNamee) ItemObject = Item:Clone() ItemName = ItemObject.Name PrevItem = ItemName for _, Object in pairs(ItemObject:GetChildren()) do if Object:IsA("BasePart") or Object:IsA("Part") then Object.CanCollide = false end end ItemObject.Parent = workspace Signal = Plane:enable(ItemObject) Signal:connect(function(location, _) if Player.leaderstats.Cash.Value >= Item.Cost.Value and game.Players.LocalPlayer.Inventory:FindFirstChild(ItemName) then game:GetService("ReplicatedStorage").Events.ClientPlaced:FireServer(ItemName, location, Cost) -- CancelPlacement() else Signal = Plane:disable(ItemObject) ItemObject:Destroy() end end) end
Part That Fires It:
local Inventory = script.Parent.Background local holder = Inventory.Holder for i,v in pairs(holder:GetChildren()) do if v:IsA("Frame") then if v:FindFirstChild("ItemImage") then v.ItemButton.MouseButton1Click:Connect(function() if game.Players.LocalPlayer.Inventory:FindFirstChild(v.Item.Value) then iniciatePlacemnt(v.Item.Value) end end) end end end