I would like to create a script which allows me to press the key "C" and it will clone what ever item I am holding!
I have managed to do that however, I would like it so when I clone the tool it appears 2 studs in-front of me instead of cloning and just ending up in my Backpack.
Heres the code I have already:
game:GetService("UserInputService").InputBegan:connect(function(input) if input.KeyCode == Enum.KeyCode.C then for _, child in pairs(game.Players.LocalPlayer.Character:GetChildren()) do if child.ClassName == 'Tool' then C = child:Clone() C.Parent = game.Workspace end end end end)
Thank you for your help.
For a position 2 studs infront of you, you can use the following:
local p = game.Players.LocalPlayer -- Get player local c = p.Character or p.CharacterAdded:Wait() -- Get Character local t = c.Torso or c.Head or nil -- Get a part from the character local Tool = --Your tool clone here local STUDS_DISTANCE = 2 -- Distance in Studs if t and Tool then -- Check if Torso / head & Tool exist --Set the Tools cframe - MAKE SURE YOUR TOOL HAS A "HANDLE" Tool.Handle.CFrame = t.CFrame + t.CFrame.lookVector * STUDS_DISTANCE else --No torso / head / tool exists. warn("Tool or Character nil!") end