Script runs in fresh new place, but does not in older one?

You can write your topic however you want, but you need to answer these questions:
Hello. I am writing a script that makes my train bogeys bob about while driving.

The script works fine in my testing place(made this year), but when I played it in a older game(which it was supposed to be used in), the script does not run. I wrote a print to make it print at the start of the script, but nothing happens.

I have 0 clue what to do, I suggested migrating the place to a fresh one, but the other admins said it would be too laggy to do and probably not worth it.
Nobody else has my issue the way I have it, as I verified everything is in check(its not very hard or specific either, it just checks for attachments named “Bolster” in script.Parent.Parent.)

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

in case it is my script, here it is;

task.wait(1)

local train = script.Parent.Parent

local function suspension(bolster:Attachment)
	print("FOUND BOLSTER!")
	local main:BasePart = bolster.Parent

	local v1 = 0
	local v2 = 0


	local default = bolster.Position

	while true do
		local velocity = math.clamp(main.AssemblyLinearVelocity.Magnitude, 0, 100)

		if velocity < 2 then
			velocity = 0
		end

		bolster.Position = default
		bolster.Position += Vector3.new((math.sin(v1)*0.02)*(velocity/45), (math.cos(v2)*0.04)*(velocity/45), 0)

		v1 += 0.04
		v2 += 0.04

		if math.random(1, 5) == 1 then
			v1 += math.random(1, 10)/100
			v2 += math.random(1, 10)/100
		end
		game["Run Service"].Heartbeat:Wait()
	end
end

for v,i in pairs(train:GetChildren()) do
	if i:IsA("Model") and string.find(i.Name, "Car") ~= nil then
		for k,j in pairs(i:GetDescendants()) do
			if j:IsA("Attachment") and string.find(j.Name, "Bolster") ~= nil then
				task.spawn(suspension, j)
			end
		end
	elseif i:IsA("Model") and string.find(i.Name, "Front") ~= nil then
		for k,j in pairs(i:GetDescendants()) do
			if j:IsA("Attachment") and string.find(j.Name, "Bolster") ~= nil then
				task.spawn(suspension, j)
			end
		end
	elseif i:IsA("Model") and string.find(i.Name, "Rear") ~= nil then
		for k,j in pairs(i:GetDescendants()) do
			if j:IsA("Attachment") and string.find(j.Name, "Bolster") ~= nil then
				task.spawn(suspension, j)
			end
		end
	end
end

Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

Issue solved, turns out the server is so slow it needs to wait for the instances to load lol

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