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

Pick up + Place Down system?

Asked by 3 years ago

Basically, i'm remaking Hello Neighbor. However, I can't, for the life of me, figure out how to make a pick up and place down system. I've tried using mouse.hit, but when it does get placed into the world, it just acts like it got removed like you just remove it from your backpack. Here's what i have so far.

script.Parent.Parent.Activated:Connect(function()
    local finish = game.Players.LocalPlayer:GetMouse().Hit.p
    script.Parent.Parent.Parent = game.Workspace
    wait()
    script.Parent.Position = finish
end)

1 answer

Log in to vote
0
Answered by
0hsa 193
3 years ago
Edited 3 years ago

You're removing it from the game, like :Destroy() you have to use something like this:

script.Parent.Parent.Activated:Connect(function()
    local hit = game.Players.LocalPlayer:GetMouse().Hit -- using the cframe here, but just to let you know CFrame.p is deprecated and you should use CFrame.Position instead.
    local clone = script.Parent.Parent.Parent:Clone()
    clone.Anchored = true
    clone.CFrame = hit
    clone.Parent = workspace
end)

P.S. if you need anymore help, contact me at [ throw 32#9470 ]

Ad

Answer this question