How would I make a repeating sequence but in one part, only make it do it once?

I am having problems making my code work without certain parts repeating in a while true do or a heartbeat strong text

Here is my code:

local RS = game:GetService(“RunService”)

RS.Heartbeat:Connect(function()
local EARTHmagnitude = math.abs((script.Parent.Position - workspace.Planets.Earth.Surface.Position).Magnitude)
local MOONmagnitude = math.abs((script.Parent.Position - workspace.Planets.Moon.Surface.Position).Magnitude)
local VENUSmagnitude = math.abs((script.Parent.Position - workspace.Planets.Venus.Surface.Position).Magnitude)

if EARTHmagnitude > 367.5 then
	script.Parent.BodyForce.Force = Vector3.new(0,0,0)
end	
	if EARTHmagnitude < 367.5 then

		script.Parent.BodyForce.Force = Vector3.new(0,-792.8,0)
	end
----------------------------------------------------------------------------------------------------
if MOONmagnitude > 181.5 then

	script.Parent.BodyForce.Force = Vector3.new(0,0,0)
end	
	if MOONmagnitude < 181.5 then

		script.Parent.BodyForce.Force = Vector3.new(0,-130.4,0)
	end
----------------------------------------------------------------------------------------------------
if VENUSmagnitude > 367 then

	script.Parent.BodyForce.Force = Vector3.new(0,0,0)
end	
	if VENUSmagnitude < 367 then

		script.Parent.BodyForce.Force = Vector3.new(0,-709.6,0)
	end

end)

Found an okay solution!

(ignore this part roblox wont let me post this until i get more charcters in)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.