Item doesnt drop the on the right position

You can write your topic however you want, but you need to answer these questions:

  1. I want this to drop the item on the right position

image


DropNonStackableItem.OnServerInvoke = function(player, getItem)
	if getItem == nil then
		return
	end
	local getItemName = getItem.Name
	local InvGuiDataFolder = player.PlayerGui:WaitForChild("Inventory"):WaitForChild("InvFrame"):FindFirstChild("SlotsItemName")
	print(getItem)
	if getItem:FindFirstChild(getItemName) then
		local ItemClone = getItem:FindFirstChild(getItemName):Clone()
		if getItem.Parent.HowMany.Value == 1 then
			ItemClone:FindFirstChild(getItemName).CFrame = player.Character.HumanoidRootPart.CFrame + player.Character.HumanoidRootPart.CFrame.LookVector * 6 -- this is where it positions it !
			ItemClone.Parent = game.Workspace
			InvGuiDataFolder:FindFirstChild(getItem.Parent.Name).Value = ""
			getItem:Destroy()
		end
	end
end

It doesnt put it on the right position on models with more than 2 parts but it does it with only 1 part models like this one
image

I also tried to reposition the model but it still doesnt work

In the Model , have you defined the PrimaryPart? If yes, then setting PrimaryPart.CFrame might work.

I tried it right now but it still doesnt fix it same thing happens

Try replacing this line:

ItemClone:FindFirstChild(getItemName).CFrame = player.Character.HumanoidRootPart.CFrame + player.Character.HumanoidRootPart.CFrame.LookVector * 6

with this:

ItemClone.CFrame = player.Character.HumanoidRootPart.CFrame + player.Character.HumanoidRootPart.CFrame.LookVector * 6

Edit: @efsane14010 Although if the ItemClone is a model, you’ll need to do this instead of the code I gave you:

ItemClone:PivotTo(player.Character.HumanoidRootPart.CFrame + player.Character.HumanoidRootPart.CFrame.LookVector * 6)

İt seems like the issue is happening because of the Unions I fixed the solution with this but i will also try yours!
image
i just added a part and welded it with the Refined Pick now it works. But im curious why does this happen ? Im still not sure if its something with Motor6D or the Unions

1 Like

Also your solution works and its easier so i will go with that. Thank you soo much. what is the difference with PivotTo and MoveTo because move to didnt work when i tried to.

1 Like

PivotTo uses CFrame and MoveTo uses Vector3

This results in a CFrame value which is why PivotTo needs to be used:

player.Character.HumanoidRootPart.CFrame + player.Character.HumanoidRootPart.CFrame.LookVector * 6

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