Problem with assigning slots to object

  1. What do you want to achieve? assigning slots to object

  2. What is the issue? when i took 2 items out of the slot leaving only the 3rd an 4th, the object overrided the 3rd slot.

  1. What solutions have you tried so far? i have no idea ;-;
function bringToSlot(slot, part)
	local prompt = serverStorage:FindFirstChild('proximityPrompts').scanLuggage:Clone()
	part:FindFirstChild('bring2slot'):Destroy()
	task.wait(.2)
	
	part.Parent = workspace:FindFirstChild('Folder')
	prompt.Parent = part
	
	part.Anchored= true
	part.Position= Vector3.new(slot.Position.X,3.1,slot.Position.Z)
	
	playSound('place', part)
	
	currentItems = currentItems-1
end

local function findSlot()
	if currentSlots == 0 then
		return true
	elseif currentSlots > 0 then
		if currentSlots == 8 then
			return false
		else
			return true
		end
	end
end

replicatedStorage:FindFirstChild('slotBringer').OnServerEvent:Connect(function(player, part)--start of the code
	local put2slot = findSlot() --returns boolean value
	
	if put2slot == true then
		currentSlots = currentSlots+1
		local slot = slotsFolder:FindFirstChild('slot'..currentSlots)
		
		bringToSlot(slot, part)
	else
		return
	end
end)

any solutions to this problem? no need to write code or anything, but its optional

1 Like

okay so i kinda solved the problem with slotFOLDER:GetChildren()[index] but now the placement is random… nice!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.