Hello programmers, I’m trying to make an item collection system like the one in “Minecraft” but I’ve run into a problem, I want to somehow detect when an item collides with another item, but even if I try I can’t get it to work here I leave the script that I am using
---------------------------------------------------
local SS = game:GetService("ServerStorage")
local Colision = script.Parent
local ItemName = Colision.Name
local Amount = Colision.Amount.Value
local SpawnItem = game.ServerScriptService.SpawnItem
local CheckStack = false
---------------------------------------------------
Colision.Touched:Connect(function(Touch)
if Touch.Parent:FindFirstChild("Humanoid") then
local ItemValueCreate = Instance.new("IntValue")
ItemValueCreate.Name = ItemName
ItemValueCreate.Value = Amount
ItemValueCreate.Parent = SS.InventoryStoraged[Touch.Parent.Name].ObjectsInQueue
Colision:Destroy()
end
end)
while true do
wait(1)
if (SpawnItem.Value == true) then
SpawnItem.Value = false
CheckStack = true
end
if (CheckStack == true) then
if (Colision.Parent:FindFirstChild("Diamond")) then -- this i have been trying
print("Funca")
end
end
end