Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

how do i make it drop from inventory?

Asked by 2 years ago

Well i have this script where it works like an inventory gui Rn i have made it so you lose your item when clicking on it but i want it to be copied right infront of you (player) in workspace

01local button = script.Parent
02button.Position = UDim2.new(0.032, 0, 0.5, 0)
03 
04local open = false
05 
06 
07button.MouseButton1Click:Connect(function()
08 
09    open = not open
10 
11    local newPos = open and UDim2.new(0.319, 0, 0.5, 0) or UDim2.new(0.032, 0, 0.5, 0)
12 
13    button:TweenPosition(newPos, "InOut", "Quint", 0.5)
14end)
15 
View all 60 lines...

since the item i will drop isnt specific it have something to do with the script here

1 answer

Log in to vote
0
Answered by
Wayyllon 170
2 years ago

I would recommend looking into LookVectors

It would probably be something similar to the following, but I'm not too good at math.

1local HRP = Player.Character.HumanoidRootPart
2local GearClone = Gear:Clone()
3GearClone.Parent = game.Workspace
4--Make sure that the parts of the item can collide when on the ground but not when in an inventory.
5 
6GearClone.Handle.CFrame = HRP.CFrame + (HRP.CFrame.LookVector * n)

Sorry for the somewhat poor explanation and answer but I wanted you to see this, definitely respond with the code you create and mark that as the answer as this answer probably isnt too helpful.

Ad

Answer this question