#make parts connected to other part orbit eachother
1 messages · Page 1 of 1 (latest)
ill show a video ok
so the wand here looks out of place
`||~~***if not game:IsLoaded() then
game.Loaded:Wait()
endtask.wait(3)
local parts = {}
for i,v in pairs(workspace:GetDescendants()) do
if v:FindFirstChild("Weldedto") then
local martyr:Part = v.Weldedto.Value
local martyr_pos = martyr.Position
local vpos = v.Position
local vorient = v.Orientation
local martyr_orient = martyr.Orientationparts[#parts+1] = {v,martyr,vpos,martyr_pos,vorient,martyr_orient} -- the equivalent of table.insert endend
local start_rotating_event = script.Parent.StartRotating
start_rotating_event:Fire()while task.wait() do
for i,v in pairs(parts) do local object = v[1] local martyr = v[2] local vpos = v[3] local martyr_pos = v[4] local vorient = v[5] local martyr_orient = v[6] local coeficient = vpos - martyr_pos local coeficient2 = (vorient - martyr_orient) object.Position = martyr.Position + coeficient object.Orientation = (martyr.Orientation + coeficient2) endend***~~||`
this is the whole script
i just want to know if 1. is there a premade solution in roblox already, and if not 2. how can i do this using math
also the parts are welded with a special object value