I am trying to re-make the Roblox inventory system and tool picking and dropping as it's pretty old and isn't that good, so I use the same technique as Ancientroboman did,
Create the normal tool, and another version which is just the model, add a key that when is pressed while holding the tool, drops the model version of it, which the model can be picked up by clicking or any other way.
By myself, tried to do this and it didn't work as expected.
First of all, the tool did get deleted and the model version did appear right under me, but the holding tool animation was still playing and the model version couldn't be picked up.
When I just put directly the model inside the workspace without having to drop it, it did get picked up and worked perfectly, but when I drop it, it doesn't work.
To pick up the tool, I have to press E but nothing was happening and the model just sat there.
Here is my tool script (it's in a local script if that wrong, please tell me.):
local uis = game:GetService("UserInputService")
uis.InputBegan:Connect(function(input, gameevent)
if gameevent then return end
if input.KeyCode == Enum.KeyCode.Q then
game.ReplicatedStorage.USPModel:Clone(game.Workspace)
wait()
game.Workspace.USPModel.Position = script.Parent.Parent.HumanoidRootPart.Position
wait()
script.Parent:Destroy()
end
end)
and this is my model script.
local Can = true
local rpl = game.ReplicatedStorage
script.Parent.Event.OnServerEvent:connect(function(Player)
local Mag = (script.Parent.Center.Position-Player.Character.HumanoidRootPart.Position).magnitude
if Mag <= script.Parent.Range.Value then
if Can then
Can = false
if Player.Backpack:FindFirstChild("USP") then
else
local keycard = game.ReplicatedStorage.USP:Clone()
keycard.Parent = Player.Backpack
keycard.Name = "USP"
script.Parent:Destroy()
Can = true
end
end
end
end)
