Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I make a Draggable Brick?

I've looked online for this and found some things, but not what I wanted. I found scripts to make a brick draggable, but u could also drag everything else. I've been scripting for over a year but im still not advanced enough to do this. If you could explain it on simple terms or show me how I would do this please help lol (Also I dont want a tool to have to be used)

2 comments

0

if you looked for something could you post it?

0

I only found https://www.youtube.com/watch?v=HW8K6FblwvI and I found a forum post earlier on how to do it with a tool

1 answer

✓ Accepted answer

heres the edited answer; u may notice that it was only a slight edit

local mouse = game.Players.LocalPlayer:GetMouse()
local mousetarget
local grabbing = false

mouse.Button1Down:connect(function()
	mousetarget = mouse.Target
	local purchase = mousetarget:FindFirstChild("Purchase")
	
    if purchase ~= nil and purchase.Value == true then
        mouse.TargetFilter = mousetarget
        grabbing = true
    end
end)

mouse.Move:connect(function()
    if grabbing == true then
        mousetarget.Position = mouse.Hit.p
    end
end)

mouse.Button1Up:connect(function()
    grabbing = false
    mouse.TargetFilter = nil
end)

16 comments

0

it uses the mouse targefilter tho if thats ok

0

the targetfilter should be fine

0

also, wouldn't a renderstepped event also work?

0

and there is a couple of minor convention errors, for one, mouse.Hit.p should now be mouse.Hit.Position and connect was deprecated in favor of Connect

0

Where would I put the script? And do I need to make any strings of anything?

0

oof

0

lol

0

nothing complicated starterpack should be fine

0

Its not letting me drag stuff, does it need to be name something? click detector? I made it a local script in the starterpack

0

well ye u gotta define the mousetarget of the scriptn to the part u want sry for tha late reply btw had t5o run an errand

0

oof thats a lot of typos

0

Omg thx so much it works

0

np

0

I tampered with the script but couldn't get it to work, how would I make every part that has a bool value in it named Purchase set to true be draggable? lol sorry for bugging u so much

0

oof i thought i was done so i didnt check sry

0

ok ill edit the above existing one

This discussion is preserved as it was. New answers, comments, and votes are closed.