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 are my tool scripts (it's a local script and server script combo): Local Script:

local uis = game:GetService("UserInputService")

uis.InputBegan:Connect(function(input, gameevent)
	if gameevent then return end
		if input.KeyCode == Enum.KeyCode.Q then

			script.Parent.DropEvent:FireServer()
		end
	end)

Server Script:

script.Parent.DropEvent.OnServerEvent:Connect(function(player)
	local clone = game.ReplicatedStorage.USPModel:Clone()
	clone.Parent = game.Workspace
	game.Workspace.USPModel.Position = script.Parent.Parent.HumanoidRootPart.Position
	script.Parent:Destroy()
end)

And this is the script inside my model:

local tool = game.ServerStorage.USP
local clone = tool:clone()
script.Parent.Center.ClickDetector.MouseClick:Connect(function(plr)
	clone.Parent = plr.Backpack
	script.Parent:Destroy()
end)

Any help would be appreciated!

1 comment

0

I think you need to clone the tool variable in the script inside your model