Hello. I have this script that scrolls parts. There is a range, a speed, and a offset.

What the problem is, is that the parts are more apart from eachother the more you increase the speed. I dont know why. On speed 1 everything is fine and the parts are not apart like this: picture text

Can you help me?

--[[
Put this script in a normal script inside a model.
Inside the model where the script is in put anything what you want in it. Turn the speed (fastness) to 10 and the parts will go apart.
--]]
local offset = 1000
local fastness = 10
local range = 0
local furthestPart = 0
function FindFurthestPart (m)
	for _,i in pairs (m:GetChildren()) do
		if i:IsA("BasePart") then
			if i.Position.X >= furthestPart then
				furthestPart = i.Position.X
			end
		else
			FindFurthestPart(i)
		end
	end
	range = furthestPart
	--print(furthestPart)
end
function Move (m)
	for _,i in pairs (m:GetChildren()) do
		if i:IsA("BasePart") then
			if i.Position.X <= range+offset and i.Position.X >= 0-(range+offset) then
				i.Position = i.Position + Vector3.new(fastness,0,0)
			else 
				if fastness > 0 then
					i.Position = Vector3.new((0-range)+offset,i.Position.Y,i.Position.Z)
				elseif fastness < 0 then
					i.Position = Vector3.new(range+offset,i.Position.Y,i.Position.Z)
				end
			end
		else
			Move(i)
		end
	end
end
FindFurthestPart(script.Parent)
while wait() do
	Move(script.Parent)
end

4 comments

0

Can you explain a bit more of what your trying to achive?

0

make it not fall apart dude be logical i have a picture i have every info you need

0

make sure its welded-

0

dude welds break when parts move