So I’m trying to make something where a player clicks something, then the script would check if there is a tool inside of their character, then delete the tool and clone itself to the CFrame of the tool that they clicked. I don’t understand how this would work, so if anybody knows, please tell me any solution you know that I could use.
local clickDetector = toolModel:WaitForChild("ClickDetector")
clickDetector.MouseClick:Connect(function(player)
local equippedTool = player.Character:FindFirstChild("TOOL_NAME_HERE")
if(equippedTool)then
--create new display model
local newToolModel = Instance.new("Model")
equippedTool.Handle:Clone().Parent = model
newToolModel.Parent = toolModel.Parent
--set the cframe
newToolModel.Handle.CFrame = toolModel.Handle.CFrame
--destroy old
toolModel:Destroy()
equippedTool:Destroy()
end
end)
2 Likes
I’ve created my own script actually and it wasn’t working, but thanks for putting the comments in for me to understand!
Also wouldn’t it be:
player.Backpack:FindFirstChildWhichIsA(“Tool”)
Nevermind I created a solution.