#Drag system
1 messages · Page 1 of 1 (latest)
I’m getting it hold up
@gleaming flare
it starts draggng and then instantly stops, the dot stays but it wont move, as if anchored until dropped, even if said dragged item is massless
according to my friend who coded it
they followed a youtube tutorial
this tutorial https://youtu.be/yBqEbvbT8_w?si=zyMs1p7HEhYGIVEL
SUBSCRIBE!
In this episode of Roblox, LMAG, I show you how I created the Lumber Tycoon 2 Grab ability. I program the script line for line so you can understand what each line is doing, and how it relates to the rest of the script. Programming your own scripts are fun and rewarding. If you are new, I highly recommend checking out my book "The Ad...
it's a roblox built-in component that does 3d dragging
much like your script, but without any code
the friend said it isnt helpful and they need the code to be how the dragging is gonna work, not a drag detecor.
its gonna be in a lt2 / oaklands style game, so for premade objects it'd work, but for new or genrrated ones it wouldnt.
(worded by my friend not me)
your friend can barely get their existing one working and they then make claims about what will or won't work? that's cute. https://create.roblox.com/docs/ui/3D-drag-detectors
ok, so for one do not insult my friend, as thrh are right on the fact that drag detectors wouldnt work when it comes to something created mid pp
playsession* not pp
such as trees or rocks.
you can create them during runtime just fine
if you aarent able to help fix the code then why avt like you have the knowlegde to do such, and the supply us with a fix that wont work for what we need to acheive
then why are you asking for help
he litteraly gave you what u need
he didnt
???
did u evne read the full thread?
???
like i said, it doesnt work on stuff that is made an item from model mid gameplay
pyro is wrong.
h
and how would u know
because we've tried it????
he acted like he could help fix the code but when supplied with it, effectiveky told us to get rid of it.
he doesnt act
he tells you his opinion
2nd off
you have search engines like google
ai that suck at coding
but can help you
people are just a last option if u dont understand a single thing
because that's what you should probably do.
i just finished reading your code and there's all sorts of problems with it
starting with the fact it's a localscript and you're trying to apply forces to replicated parts.
meaning, you're trying to move parts that, in all likelihood, will belong to the server.
that's why the parts don't move for a start.
wait a minute
ive seen in natural disaster
that exploiters
are able to move
parts
in a circle
arent exploits client sided?
if thats it how are
they abl eto do it
the item will be server sided, yeah, becuase its a r
an open world exploration tycoon.
if a game did it 10 years ago and still has their code working then clearly the 'only option' isnt a drag detector???
because the place owner isnt dumb
and knows how to update his script
up to date
this is most likely a 10 year old tutorial
or someting
lt2's code is severely outdated
not at all
the roblox studio code is gonna change all the time
because its gonna update
to make it better
old functions may get removed
but replaced with better ones
and defaultio aint that dum
lt2 code hasnt updates since 2014
** You are now Level 3! **
are u sure
maybe big updates ok
but event items
security measures
are still being added
yeah, its a widely discussed phenominon as to why it hasnt fell aprt
aswell as new trees
thats changing the rgb values of the same pumpkin every year
hardly an update
one tree in 10 years
as for why the ball isn't moving, setting aside you're using deprecated features BodyPosition and BodyGyro, that's probably coming from the weld weldBetween(DragBall,GrabObject) which then goes back to the first problem (the server-owned part doesn't move), and also happens to be using another deprecated feature, ManualWeld. your math for the movement of the ball looks fine, so i'm pretty sure it's the weld.
the server will share network ownership by default. if an exploiter happens to gain ownership, they can do whatever they want to it.
resulting in no flinging and stuff
natural disaster doesnt have a backdoor
what do u mean by depricated features of roblox of lt2
im refering to pyro's newest reply tomy initial request
which refers to some issues which break the code
and im asking what we'd do to fix it
anyway yeah it's not the only option, but your code has aforementioned issues. if you want to drag stuff, you'll want to include the server in it so it can give network ownership appropriately and then you can drag it on the client. but why bother with all that when you can just use the dragdetector
it has all the same features as your code, is more stable, and replicates to the server automatically.
not to mention, it is cross-platform compatible, whereas your binding to mouse1 means it only works on pc. dragdetector works on all platforms.
when we tired to add it to the game, it just made the attatched part act like it was on a hinge
also looks like there's a fun edge case in your code where the ball has collisions enabled, so it'll collide with the mouse ray. should be fine between the ball and the part though because of the weld.
here, speak to the owner of the game @spark parcel when they can speak after 10 minutes
yeah idk why you were asking on their behalf to start with
because they make all finalised choices, i was just the middlewoman whist they tried to fixicstuff on their end
i have been wanting to bring this up a long time ago
anyway, like i said the first time, the way to "fix" your broken, decades-old code is to throw it out and use more modern techniques. it's all described in this page and has tonnes of code samples you can use.
they were trying to fix it on their end whilst i was trying to seek advice on fixing the code from people i had hoped were going to do so, especially as this server has been reportedly helpful to new coders and general devs, and promoted as such.
im doing the same thing
but no middle man
just me
i am both experimenting and making posts
unless im bored and im playing roadblocks
the code i supplied in this thread is a 4 year old tutorial, not decades.
im.. sorry i dont code..?
im saying that HE can do it
you can seek out advice from roblox studio docs
ai
stuff like that
not just rely on humans
and im sorry she didnt know about this server already????
fucking ew
first of all it codes better than you
the whole point of making our own script is so we dont have to resort too support of ai
THIS GUY CAME OUT OF NOWHERE WITH THE BEST PIECE OF ADVICE
by genrating script lines off of stealing from thousands??
that doesnt make sense
ai learnt how to code by scanning and extracting from tens of thousands OR MORE people
it can also search the internet
take chatgpt for example
u can toggle search on internet
and then steal the code???
and whats the problem with that? Does me learning from other people's code mean I'm stealing it?
it can extract from everywhere, even here or dms
hes saying that chatgpt is a big backdoor for everything in the world
so those
you wouldn't know how to use it
what was it
hundered thousand games thqt got taken down in 2020 for stealing defauliutos code
code isn't like models and gui
didnt steal???
thats because they were FULLY decompiled
even games containing his code got removed
from line 1 to the end
Okay then.
ye what if I change one variable, now its not his code
Hello "Coders".
change the lines a bit
so u guys arw a bunch of ai using prats, and not coders is what im getting.
loosely because you people don't even touch code and just let AI do everything for you..
why are you putting that in colons
bro Ik how to code better than you
who lied to bro, how would you even know
bro u litteraly skidded off from a video that was posted FOUR YEARS AGO
the whole REASON i made this script off a tutorial was BECAUSE i didnt want to use ai or the toolbox.
AI IS NOT THAT GBAD
i was learning from it at the very least.
UNLESS YOU CREATE WHOLE GAMES FROM IT
so use the docs then, along with recommended roblox features to drag things in 3d space
https://create.roblox.com/docs/ui/3D-drag-detectors
you'd know a lot about that, wouldnt you?
exactly, its for effeciency, and getting things done
i agree with him
getting things done? what a joke..
instead of skidding off 4 year old outdated tutorials that evidently don't work properly 
you wouldn't use ai, if you don't know how to code
IT LITERALLY IS THAT BAD
thats exacly why there are ANTI AI PROTESTS YOU IMBECILe
THATS BECAUSE PEOPLE
HATE AI
FOR NO REASON
LIKE YO
U
it LITTERALY
because it steals from other creators? hence artists?
helped me ALOT
you.
what can it steal money?
MAKE ONE WORKING PEICE OF CODE WITHOUT ANY Ai IMPUT THEN
IF ITS SO EASY
yes, actually
print("its that easy")
yes actually it fucking can numbsack
loads of cases of ai getting credit for source material
artists?
oh you poor soul
i feel like people can tell diffrence from this
and this
wanna see my scripts?
lmao
i feel like people know the diffrence which one is which
"art" is something that ai cant trully recreate as of right now
Look ai is an effeciency tool, if you don't know how to use its your problem
generate full on piccaso type shii
anyway it seems like they came here just to get people to fix their code for free rather than for getting help, so that's me out
we all out
i agree why did i even come here i need to fix my own problem
keep calm and make games 
so how your guys' day been
you are comparing an ancient painter with skill unrivalled from all of history to a meta ai image.
bro chillax, don't use ai since your so goated mate
meta ai is one of the lowest quality ai generators.
who?
are u that stupid
who asked?
bro, if you don't want to use ai
then don't
stop the yap
nah im out fr this time
instead of skidding off ai, skid off other people and ancient tutorials instead? makes total sense to me! 
for the record i'm 99% sure the original problem of parts not being dragged from a localscript was because the client didn't have network ownership of the dragged part, paired with using deprecated features. there may have been other problems but it's just easier/better to use a dragdetector.
@mighty bronze btw proof that ai helps
from my previous post
i couldnt figure out
how to get my saving to work correctly
and ai helped me to do it
turns out i was saving stuff incorrectly
the only reason im not using drag detectors is because for the purposes of my game, i'd need to add drag detectors to every new created item, i believe
though i dont know how it works exactly, i wanted a script that ran locally off the player, which that tutorial provided
every unanchored object in the game can be dragged in theory
it's above i believe
ghazzy crashed out and deleted it
sigh
its fine, i recall most of it
it isnt their fault, the reason they sent it instead of me was because i couldnt actually talk yet
in addition i also couldnt get to the script and copy it (i have a terrible computer)
which is also why i wanted to make it work so badly. it took hours to actually make because of my current situation.
** You are now Level 1! **
i didnt just want that work to go down the drain for a simple toggle that would yes, be more effective cross platform, but be more complicated to apply to say, a lumber tycoon style game
a good ol lumber tycoon game never hurts
if you want it purely local, which drag detectors can do, then the parts need to be network owned by that client, or dragdetector.RunLocally
@gleaming flare you shouldnt put stuff in hyper links
moderators dont appreciate that much sometimes
and people think its another free steam giftcard
its a lot more ambitious than just a lumber game, i wont spoil it, but if i can pull it off despite my lack of coding knowledge..
dude
yes, add a drag detector to everything. i suggest adding them all from a script.
i gave u possibly working code
did it work tho
** You are now Level 13! **
lmk if it works
it takes 20 seconds to open the file explorer.. on a good day.
make sure to ping me
working as expected.
this is incorrect, see provided evidence.
for me it REFUSES to work 😭 hold on
so uhhh.... yeah, that conversation was a funny one wasn't it?
funnily enough this is made by ai
kms 🔥
half of it was surprisingly similar to my script
source material who
vineboom.mp3
i didn't mean it as an insult, i meant it as an acknowledgement they are most likely mistaken. which turns out to be a correct assessment of the situation. how about that.
i'm aware
@spark parcel call ur freind back over here and prove him that ai is useful (dont make it a rage bait)
he wont be happy if it is
im not meaning to make this a ragebait btw
i think their jimmies have been rustled enough, just passing that fact along with the script is enough to learn.
we know ai is useful, we never said it wasnt
our argument is you don't really learn anything from it
it's a soulless algorithm
it can, granted, be used to correct errors in existing code
but to generate it all from nothing from words? we considered that the easy way out.
** You are now Level 2! **
it is useful and has its applications in certain scenarios,
but for what it is i want to learn through experience, not rely on a program to do my work for me. that ruins the whole point in my eyes
teach a man how to fish kind of concept, you know?
for the record you can sometimes move parts because sometimes the client has network ownership and sometimes not.
the new script has the same problem, you need remote events to make it replicate properly 
dies
why can't dragdetector apply to the player when the mouse hits an unanchored part?
is that even possible?
like that would solve a lot of problems, but to what i know i cant apply it to a player, only to a part
it would be a universal script, not a ton of drag detectors
if you tried i suspect you'd have to double click on it which would be weird
which i imagine would cause a lot of lag
though, you wouldnt need to care about the drag script
like imagine like 200 bricks all with dragdetector on
to be fair 200 bricks by themselves would cause stupid amounts of lag
you may be able to make a drag detector on click if you do it early enough in the frame like with bindtorenderstep
but still
i haven't tested it though
and then like.. delete it afterwards?
not really
like once the mouse releases it deletes that instance of dragdetector?
ye delete on drag end
hmm..
then your only code is managing the dragdetector instead of the actual functions of dragging stuff, applying force etc, it's instead wrapped up in a neat package
wouldnt it need an initial drag detector to sense WHEN you're dragging though? like as a trigger?
lol clickdetector
srsly having 1000 click detectors + drag detectors isn't as expensive as you might think
true, but would it not be neater to just have a brick of code for every unanchored item?
instead of like 1000 detectors on every item?
then again, dragdetector inherits from clickdetector and so behaves as a click detector in addition to the dragging feature https://create.roblox.com/docs/reference/engine/classes/DragDetector#events-inherit-ClickDetector
itd look a little messy
performance is not an issue here.
also fun fact: the game i intend to make is supposed to be hyper performant
if you're going to unanchor something give it a drag detector
like.. insanely optimized. anyone could play it.
thats what i aim for
i cant cut corners here in this situation..
i have to assume anything can cause lag
the whole reason i even want to make a game is because the game i play currently is laggy, unoptimized, and the devs dont listen to the players
i want to make a community that accepts all despite specs and interests
it is almost impossible to know which code will and will not cause lag without benchmarking.
you can fish and itd be so high quality you could tell someone it was a specifically fishing game
or mining, or chopping trees,
depends on the game and the kind of lag.
or exploring the sky islands..
server lag, sandbox game
they refuse to fix it because it doesnt make them significant income
apparently only 3% of their income is from mobile/weak devices
so they, in their eyes, have no incentive to optimize
like 2 fps on both 1 graphics bar and 10. no difference.
every other game is fine. games of similar genres are 60 fps usually.
you sure it's fps?
it has an fps counter..
lag gets significantly worse with more players,
and even when starting out, there isnt a textureless mode or something to reduce lag
coupled with the sheer amount of exposed faces that constantly check for collision, cars flinging..
** You are now Level 3! **
it is a mess.
next time you play it, take note of the level of recv in the f7 overlay. if it's any higher than 150~200 then you should expect lag.
physics is very expensive on network and can result in lag.
there's not really a way to fix it.
true, but the thing is it's like.. NO other sandbox games like you have this lag. WHY are we lagging here?
similar concepts, similar mechanics,
the game i'm talking about is oaklands by the way.. and i'm comparing to lt2 and rc2
it has terrible performance compared to the 2
either way you shouldn't worry about performance too much until your game actually has a performance problem
true, but then you'd have to find WHY its lagging.
in my eyes i'd want to make sure from the START everything is as lagless as i can possibly make it.
roblox has tonnes of debugging tools
and this is exactly what you dont want to do.
besides
that is certainly a way to graph performance
speed of light as a measurement is bonkers
the only way to know how some code will perform is to benchmark it.
also why is a whale a measurement in terms of light (yes i know its a scale to give an idea of how to comprehend the number but its just funny to me)
if you're working on something you think will be expensive, then stress test it and find out
good idea.. im just worried in the end i'll make something that only certain people can play, or that itll work but itll be a slideshow
yes, i worry too much. yes, thats a flaw of mine
i just dont want to invest hours into something that wont work.
doesn't matter, you can work on that over time. start with something functional. don't get stuck in premature optimization
cough..... drag script. cough.
still cheesed about my og script tho.. who knows, maybe i can just take from the toolbox and make a rough model of the game (very rough), and then refine it later
considering the one i got doesnt have rotation, or distance modding
oh good you can restrict who can interact with the dragdetector https://create.roblox.com/docs/reference/engine/classes/DragDetector#PermissionPolicy
(moving further and closer with shift and scrollwheel)
the new script is the same as your old one
except a few structural changes to make it flow a bit better
easier to read etc
it did
i've said this like 10 times now. the problem was the client didn't have network ownership.
worked for a split second and stopped
nono wait let me explain
it worked, but it was complicated
you made the same mistake with your original code as you did with the new code, seen right here.
it worked for a second, and weirder, it PARTIALLY worked
when grabbing an object, it held on and rotated it to match the rotation of the player relative to where they grab from
yeah i've messed with local parts being constrained to server owned parts, it gets pretty jank. in summary, don't do it.
it then just.. held the dragball where it was. sob. so wheere and HOW do i fix it? is there a specific place/folder i need to put it, or to make it just a script and NOT a localscript?
this has been explained many times
nono, i get dont make it local, im just trying to get things straight
is it JUST a script?
does that fix my problem?
this is all going over my head.
** You are now Level 4! **
idk what you're paying that other guy but you may want to hire someone else #👷︱for-hire or you can post a job in #💵︱hiring
nothing, we're just good friends
i start to tune out when a conversation devolves into 'wHeRe Do I pUt ThAt' so uh best advice i can give you is to either hire someone who knows what they're doing to help you out, or learn for yourself https://create.roblox.com/docs/tutorials/fundamentals/coding-1/coding-fundamentals. no one here is going to go out of their way to write code for you because most are working on their own projects. help is diagnostics and direction, not free code.
no, what im asking is.. HOW did it work for you, and not me? thats all
i'm not asking for you to develop my game..
im just curious how i messed it up that badly
i put their script in starterplayerscripts and it just worked out of the box as expected. critical fact is, as expected. i expected it to not work consistently on server parts, only when i'm near them, and work flawlessly on clientsided parts, which is exactly what was shown. (i had to click twice on the local part since the first click was sunk on focusing the game window)
kms, i put it in starterCHARACTERscripts.
it would work there too
though this probably is better placed in startercharacterscripts tbh because of local character = player.Character or player.CharacterAdded:Wait() which would stop it working if the player dies once
so yea put it in there, it's better there. i didn't care about that and just put it anywhere that it would execute.
you messed up because you and the other guy aren't experienced enough to know these things like network ownership.
that's why... hire someone who knows what they're doing ;o
anyway good luck with things 
@gleaming flare Theres so many messages that I'm confused but I would like to have a drag - system, can you sum up how you do it from your experience because i did not understand anything frm the arugment above
put dragdetector on everything. if your game has 10,000 of them, totally fine. yes there's a performance cost but it is very small, comparable to having 100,000 parts in your game which is also fine. you can try to do the math and replication yourself if you really want to, but for beginners, just go with 10k dragdetectors.
holy 10k
tbh he could detect if his mouse is hovering over basepart and then spawn it
instead of having 10k
but if its too complicated then what pyrofire said should od the trick
the problem is it needs to be on the server for it to replicate. this would work for client-sided parts tho
...but that was the original problem 
then just do a remote event?
if he is able to do this remote event finicky stuff it'd be much better
but ig, if he can't really code the drag detectors will do
how else are you going to include the server in it?
you just add the drag detector after the remote event is fired, and as you said dragdetectors automatically replicate to other clients
and when the player stop dragging the part, just fire the same remote event and remove the dragdetector
then you get input delay and most likely need to click twice ;p
well, ig so
but its either that or loading 10k drag detectors
you don't really need to clck
you could just fire the remote event
when the player is hovering over the part
their original would work fine all they had to do was fire a remote and tell the server to give network ownership, that's it.
and obv you need one that strips network ownership when its dropped
technically exploitable but if you make this limit to 1~2 parts and distance check, and validity check (player cannot pickup the ground), then you're good
but they dont know how to do that
ye, ig its probably better if he does the 10k drag detectors
if were taking his coding ability into consideration