Okay, so I managed to get an accurate form of gravitational pull by using solely the LocalScript below
local character = script.Parent.PrimaryPart
local planetoid = game.Workspace.Planetoid
local atmosphere = planetoid.Atmosphere
function gravityFunction()
if character then
--The thing I want goes here.
character.CFrame = CFrame.lookAt(character.Position, planetoid.Position)
end
if character and not character:FindFirstChild("gravityPoint0") then
local gravity = Instance.new("LineForce")
local gravityPoint0 = Instance.new("Attachment")
local gravityPoint1 = Instance.new("Attachment")
gravity.Parent = planetoid
gravity.Name = "gravity"
gravity.ApplyAtCenterOfMass = true
gravity.Magnitude = 1000
gravity.Attachment0 = gravityPoint0
gravity.Attachment1 = gravityPoint1
gravityPoint0.Parent = character
gravityPoint0.Name = "gravityPoint0"
gravityPoint1.Parent = planetoid
gravityPoint1.Name = "gravityPoint1"
end
end
atmosphere.Touched:Connect(gravityFunction)
If I can just make it so that the BottomSurface faces the planetoid instead of the FrontSurface, and then tweak the camera, my gravity script will be complete. The only thing holding me back is that I don’t know how to adjust CFrame.lookAt to do so. I couldn’t find any tutorials related to what I want to adjust, so I turned to you for help. Got any ideas?