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

Any Cframing help?

Asked by 10 years ago

I love weather, so I am making a weather script for my personal place. I built some "clouds" and trying to script them to fly over head. I have no clue what to do with Cframe. (I build with Cframe Tools) But I don't know how to script with it. What I got so far is:

wait (5)
Workspace.Cloud1.part.CFrame = CFrame.new(0, 50, 0)
wait (5)
Workspace.Cloud1.part.CFrame = CFrame.new(0, 50, 0)
wait (5)
Workspace.Cloud1.part.CFrame = CFrame.new(0, 50, 0)

Now. I know I have to change new based on my current location. But I do no know how to do that. Also when I move it. It loses its tilt. Any way to keep that?

(Any and all help will be greatly heeded, Please don't try me to copy a script. I am here to learn lua not copy and paste.)

2 answers

Log in to vote
1
Answered by 10 years ago

Best way to do this is by inserting a new instance of BodyVelocity into the parts. Basically, it will move the part much like a cloud if you will. Remember that Vector3 represents location, while CFrame represents rotation values. Here is a quick code, though it's not tested.

cloud = script.Parent
move = Instance.new("BodyVelocity")
move.Parent = cloud

while cloud do
cloud.BodyVelocity.velocity = Vector3.new(2, 0, 0) 
wait(2)
cloud.BodyVelocity.velocity = Vector3.new(2, 0, 0)
end

I'm also new to Lua, so if there's any problems, please reply and I'll be happy to help.

~Kyo-chan

0
Tested the code, and there are some problems with it. Though it will move just like a cloud would. I will fix it if you wish. Misclear 95 — 10y
0
Hm, I see if I can fix them myself! :D Thanks a lot. If I can't get it I'll just PM you on Roblox. :p LuckTron 15 — 10y
0
All right, glad I could help in some way! :) Misclear 95 — 10y
Ad
Log in to vote
0
Answered by 10 years ago
wait (5)
Workspace.Cloud1.part.position = poisition.new(0, 50, 0)
wait (5)
Workspace.Cloud1.part.position = position.new(0, 50, 0)
wait (5)
Workspace.Cloud1.part.position = position.new(0, 50, 0)

Position and rotation also help really well.

Answer this question