Help On Drop Item System

Hi

i have some short problem… so i make some dropping item with Q keybinds but some reason… i cannot make the Object follow the camera when it drop, and if i press Q key, its just go back to the position where the object placed are…

i appreciate when someone help with the coding system… here is the code:

local UIS = game:GetService("UserInputService")
local Object = workspace.Gun
local Players = game.Player.LocalPlayer
local Tool = Players.Backpack:WaitForChild("GunTools")

UIS.InputBegan:Connect(function(input)
     if input.KeyCode == Enum.KeyCode.Q then
          Tool:Destroy()
          Object.Transparency = 1
          Object.CanCollide = true -- I cannot make the object follow the camera when its dropping, so i make this
     end
end)

Thanks For Read, BaconDev (@RebornCoke)

1 Like

I’m a little confused by your above grammar but by your code doesn’t really seems to be dropping any item in front of the player pressing Q.

  • You might wanna rewrite your code
  • And add a debounce/wait

Sorry I can’t give you an example code off your base code because dropping system require a GUI/button to be pressed so the dropped item can be destroyed and add a tool into the player backpack. If you need a full script help hiring a developer on Talent Hub should help!

its ok

hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh (for min chars)

If it helps any at all I can give you a base to work off so you can improve and adjust your own code.

If i read this correctly, Your issue is that you aren’t positioning the weapon at all, Instead you’re just making it appear.

To make the weapon actually appear infront of the character, Here’s an example.

local UIS = game:GetService("UserInputService")
local Object = workspace.Gun
local Players = game.Player.LocalPlayer
local Character = Players.Character or Players.CharacterAdded:wait()
local Tool = Players.Backpack:WaitForChild("GunTools")

UIS.InputBegan:Connect(function(input)
     if input.KeyCode == Enum.KeyCode.Q then
          Tool:Destroy()
          Object.Transparency = 1
          Object.CanCollide = true

          Object.CFrame = Character.HumanoidRootPart.CFrame*CFrame.new(0,0,-3) -- -3 may need to be 3 instead
     end
end)
4 Likes

ok, its worked, thanks :smiley: i can use it on my game now