Explanation
Goal
Attempt
cube = workspace.cube sphere = workspace.sphere Weld = Instance.new("Weld") Weld.Parent = cube Weld.Part1 = sphere Weld.Part0 = cube Height = 4 while wait() do Weld.C0 = cube.CFrame:Inverse() * sphere.CFrame * CFrame.new(0,Height,0) end
Pre-Solution
--How to find relative: cube.CFrame:Inverse() * sphere.CFrame
This is a pretty complicated solution so it might not work right away but I had a situation similar to this one day when i was messing around and it was for a ball with a click detector that i needed it to start going up and to the left when i clicked the way i ended up doing it was using body velocity and making a child to a part i had created in the same script to do this i used
local children = Instance.new("BodyVelocity", Part)
to make the body velocity (it was a bit ganky at first but ended up working
the problem i ran into was that it was set to going up but i needed it to go up and to the left so i had to set the body velocity's x, y, z velocity to new values
i did this by putting right under it
children.Velocity = Vector3.new(-10,10,0)
and IT WORKED
so with my new found knowledge i used it to do the childish thing of making a noob start pissing into the sky the final code was
local Click = script.Parent local brick = script.Parent.Parent Parts = {} function whenMouseClick() for count = 1, 50 do Parts[count] = Instance.new("Part",game.Workspace.AnthonysPlayground) Parts[count].Name = "Piss"..count Parts[count].Color = Color3.fromRGB(164,168,50) Parts[count].Shape = Enum.PartType.Ball Parts[count].Size = Vector3.new(0.5,0.5,0.5) Parts[count].Position = brick.Position + Vector3.new(10, 1, 0) local children = Instance.new("BodyVelocity", Parts[count]) children.Velocity = Vector3.new(-10,10,0) print(Parts[count].Name) wait(0.1) end end Click.MouseClick:connect(whenMouseClick)
and it turned out pretty funny Hope i helped and good luck on your project!