Glad it helped! As I said the purpose of this article is not to copy paste the final script, it’s to understand multiple other subjects that can be very useful such as uses for .Unit
and understanding origins
, and being able to do tricks with the mouse. If you want a better system that adds a lot more features, take a look at this.
I’m a beginner in scripting so I was searching for a topic which can help me make a drag script that will actually help me in my test script learning place. The thing I want to do is simply apply this drag system to my ice cubes so they get moved the order I want and this is a pain with body pushing because they also get anchored when not moving for 40 seconds to clear the lag so here’s the issue:
I just copied the script and pasted it into a script located into the ice cube but for some reason it doesn’t work. I probably need to add events in ReplicatedStorage (as I was looking at Button1Up and Button1Down) but I definitely need some help to actually make it work since I got pretty much no knowledge about ReplicatedStorage and ReplicatedFirst. Sorry for this nooby reply but everyone started from somewhere and here is my beginning.
I think its not working for me…
I think the error is pretty obvious. Which is why I repeat again, the goal of this article was not to copy paste the end code, it’s to salvage new information.
Instead of
target.Force.CFrame = target.CFrame
--do
target.Gyro.CFrame = target.CFrame
how would you implement this server side?
Physics always replicate if the player has network ownership over that part
This phrase is really important! Anything that involves physics, moving a part, a part falling, the player walking, all that replicates automatically by roblox if the player has network ownership. If you move a part in the client, other players will see it move as well.
So I followed and read through the entire tutorial and for some reason it doesn’t work for me. Whenever I try and drag a part it creates the Gyro in the part but the part doesn’t move at all. I even tried to just copy your script at the end and it still doesn’t work. Did roblox change something or am I just dumb
Update:
Nvm so for some reason I have to wait like 30 seconds in my game for it to start working. Not sure why this is happening when I literally have like 4 other scripts in the game.
Ahh I’ve written something like this before. The problem is that it cannot be used with TouchTransmitters
and .Touched
events.
I can see you made a topic about your problem as well. Network Ownership
might be indeed the problem, I didn’t want to bring that up in the article to omit confusion, but I think I should now.
Is there way to add pull and push keybinds to it?
What you can do is store a variable to keep track of how far the part is currently away from the player. If you push button X you increase that value which is the same as pushing away from the player, if you push button Y you decrease that value which is the same pulling in to the player. Whenever one of the buttons is pressed, update the value, and call a function to update the part’s position relative to the current distance.
Whenever I try to make a new part and put the value into the part, I cannot move the part for some reason. So if I want to make a union I can’t do that because it is making a new part even when I put the string value into the part. @starmaq
What are you doing exactly? The article isn’t creating a part or anything, so are you sure that you’re doing things correctly? Are the parts unanchored?
All the settings are set the same as the original part, however when I put the value into the newly created part it simply does not work.
Are you :Clone()
ing the part and moving the cloned part? Your problem seems off-topic from this article’s premise, maybe make a #help-and-feedback:scripting-support topic.
Forgive me as i am quite new to scripting but:
Adding a maximum range to the object seems to break everything
mouse.Target.Position = mouse.Hit.Position.Unit * 20
when I do that i get the error
players.crolaa.PlayerScripts.LocalScript:18: attempt to index nil with ‘Position’
So first i thought, hey maybe I typed something in wrong, eventually got to the point of retyping everything then just copy and pasting.
None of which fixed or helped at all.
I have no clue what is causing this and would appreciate some help.
Great tutorial by the way, Very useful stuff.
This means that either Target
is nil, are you checking if it’s not nil?
if mouse.Target ~= nil then
Position setting requires you to use a Vector3 so look at doing that next.
It is a vector3
mouse.Hit.Position.Unit * 20
does yield a Vector3
Or do you mean something else?
sorry my bad. I thought .unit was just a number not a normalised vector3