Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do i make so that my player can place tools as anchored parts in the game?

Asked by 4 years ago

Please provide more explanation in your question. If you explain exactly what you are trying to accomplish, it will be much easier to answer your question correctly.

So i learned how to make the player grab barts by making a model for the tool and a model for the part but now i want to know how do i do the opposite?

1 answer

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

There's not enough information on your Question to give an answer. But hopefully I can help. I made a Part in Workspace with a Click Detector inside of the Part. Along with a Server Script inside of the Click Detector. The Script allows a Player to click the Part to obtain the Part as a Tool into their Backpack. Once the Player Equips the Tool, the Player can Left Click to drop the Tool into Workspace as a Part. And the method of grabbing and dropping the Part is infinite. Along with no errors. Hopefully you can study this code to get an understanding and apply it to your code. Here's the Code:

script.Parent.MouseClick:Connect(function(plr)
    local tool = Instance.new("Tool")
    local handle = script.Parent.Parent:Clone()
    handle.Name = "Handle"
    handle.Parent = tool
    tool.Parent = plr.Backpack
    script.Parent.Parent:Destroy()
end)
script.AncestryChanged:Connect(function(ancestor)
    if ancestor.Parent:IsA"Model" then
        if ancestor:IsA"Tool" then
            local tool = ancestor
            tool.Activated:Connect(function()
                tool:FindFirstChildOfClass("Part").Parent = workspace
                workspace.Handle.CFrame = ancestor.Parent.HumanoidRootPart.CFrame * CFrame.new(0,0,-5)
                workspace.Handle.CanCollide = true
                tool:Destroy()
            end)
        end
    end
end)
Ad

Answer this question