Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Drop things from inventory, but not at the wanted position?

Hello, i made an inventory gui and a button to drop items (wich are group models) for that everything is fine the only thing is that i want the item to drop in front of the player but i can only make it drop like 2 blocks away from the player but always on the same side wherever my character is facing, it will be say, -2 blocks away on the x axis of the workspace.

thats the line used to do it

drop:SetPrimaryPartCFrame(CFrame.new(player.Character.Torso.Position.x -2, player.Character.Torso.Position.y -2.7, player.Character.Torso.Position.z ))

1 answer

✓ Accepted answer
hcf = MainPart.CFrame
fp = hcf.p + hcf:vectorToWorldSpace(Vector3.new(0,0.4,-1.1))
scf = CFrame.new(fp,YeniEk.Position)
ilkKutuk.CFrame = scf + (scf.lookVector * ((ilkKutuk.Size.Z/2)-1))

So, this is from my old library which I used to generate random trees. This was handling my trees' positioning and rotating needs. But to be honest I forgot what does what actually. I think scf is position, multiplying scf's lookVector with size of ilkKutuk gives us the correct position. So, I suggest you to do something like this:

drop:SetPrimaryPartCFrame(player.Character.Torso.Position + (player.Character.Torso.CFrame.lookVector * -2))

Not sure if it will work or not.

3 comments

0

with this line i get this error: Players.Player1.PlayerGui.UI.Inventory.Menu.LocalScript:26: bad argument #2 to '?' (Vector3 expected, got CFrame)

0

Edited it(Just deleted CFrame.new)

0

now i get: Unable to cast Vector3 to CoordinateFrame

This discussion is preserved as it was. New answers, comments, and votes are closed.