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

How to weld to a rotating part without rotating?

Asked by 6 years ago
Edited 6 years ago
So basically, im making a fast-paced marble racing game where the ball rotates insanely fast, and I'm trying to add accessories to it.
But, I dont want those attachments to rotate, but I want them to stay in the position of the marble. If I use a weld, the accessory will just rotate.
If I constantly update a CFrame, it will look insanely laggy. Any ideas?

*Edit: Forgot to mention, I am currently using the marble's velocity that constantly updates depending on where the humanoid's MoveDirection is going.

0
hmm, for some reason it formatted like code. can't figure out how to format it back to text. sorry about that Protori 0 — 6y

2 answers

Log in to vote
0
Answered by
Shadrz 40
6 years ago
Edited 6 years ago

You could possibly add a StringValue called Object in the Handles of Accessories, I'd imagine you use a for loop that rotates all the objects. Anything called Object will be put in a part you wouldn't want to rotate so you can put an if statement in the for loop. Let me demonstrate:

if not v:FindFirstChild("Object") then 
    -- code here
end

Edit: I forgot to mention that this allows you to weld without rotation. Edit 2: Put a StringValue in all Parts inside the character that you would not like to rotate. Edit 3: I was told that my code is outdated, so I updated it.

0
findFirstChild is deprecated User#19524 175 — 6y
0
and please don't teach bad practices, either teach good code or don't teach at all. Your code could be simplified to: if not v:FindFirstChild("Object") then User#19524 175 — 6y
0
Thank you, I've been coding for multiple years so I have some old habits. Shadrz 40 — 6y
0
Oh sorry, forgot to mention, I'm using velocity on the marble that constantly updates with the humanoid's movedirection. I'm using velocities, so.. Protori 0 — 6y
View all comments (2 more)
0
I don't think that would change this code and make it not work. Shadrz 40 — 6y
0
Oh, sorry, I'm not sure I quite understand what you mean. Do you mean every second I should rotate the accessories on the marble back to have a rotation of 0? And if so, I should do it client side due to massive lag, correct? Protori 0 — 6y
Ad
Log in to vote
0
Answered by 6 years ago

I dont know too much lua, but you could make a block that always copies x,y,z position of ball and that keeps a rotation, later, you could weld the hat to that block:

Red is block/ Blue is ball/ Green is hat/ Yellow is weld

https://ibb.co/fQZVFz

0
That's what he said would make it laggy with the CFrame position. Shadrz 40 — 6y

Answer this question