I made a script that generate stars with accurate Position but, when i click play some parts was missing other created, when i click Test the all part created successfully. In script output i dont see any error. How to fix this? This make me insane.
Script in Serverscriptservice
local sun = Instance.new("Part")
sun.Shape = Enum.PartType.Ball
sun.Color = Color3.new(1, 1, 0.2)
sun.Parent = workspace
sun.Position = Vector3.new(0, 0, 0)
sun.Anchored = true
sun.Name = "Sun"
function starmap(RA_h, RA_m, RA_s, Dec_deg, Dec_m, Dec_s, Distance, apparent, startype, name)
local A = math.rad((RA_h * 15) + (RA_m * 15)/60 + (RA_s * 15)/3600)
local B = math.rad((Dec_deg) + (Dec_m / 60) + (Dec_s / 3600))
local C = (Distance * 3.26) / 2-- convert ly to parsecs
-- Cartesian converter
local X_car = (C * math.cos(B)) * math.cos(A)
local Y_car = (C * math.cos(B)) * math.sin(A)
local Z_car = C * math.sin(B)
--Create a star and location
local star = Instance.new("Part", workspace)
star.Shape = Enum.PartType.Ball
star.Position = Vector3.new(X_car, Y_car, Z_car)
star.Material = Enum.Material.Neon
star.Anchored = true
star.Name = name
star.Size = Vector3.new(10,10, 10)
star.Archivable = true
star.CanCollide = true
star:SetAttribute("Namer", name)
-- Star class type identifier
if startype == "O" then
star.Color = Color3.fromRGB(155, 176, 255)
elseif startype == "B" then
star.Color = Color3.fromRGB(156, 178, 255)
elseif startype == "A" then
star.Color = Color3.fromRGB(185, 201, 255)
elseif startype == "F" then
star.Color = Color3.fromRGB(224, 229, 255)
elseif startype == "G" then
star.Color = Color3.fromRGB(255, 248, 252)
elseif startype == "K" then
star.Color = Color3.fromRGB(255, 238, 221)
elseif startype == "M" then
star.Color = Color3.fromRGB(255, 195, 139)
end
local M = apparent - 5 * math.log10((Distance / 3.26) / 10 )
local x = 2.512^(4.83 - apparent)
star.Size = Vector3.new(x, x, x)
if star.Size.X <= 0.05 and star.Size.Y <= 0.05 and star.Size.Z <= 0.05 then
star.Size = Vector3.new(0.05, 0.05, 0.05)
end
if star.Size.X >= 5 and star.Size.Y >= 5 and star.Size.Z >= 5 then
star.Size = Vector3.new(2, 2, 2)
end
if C <= 50 then
star.Size = Vector3.new(0.05, 0.05, 0.05)
end
end
if not game.Workspace:FindFirstChild("Alnitak A") then
print("Star missing!!")
end
-------------------------------------------------------------SET OF STARS FROM INTERNET --------------------------------------------
-- LIMIT : ONE THOUSAND STARS AND 100 DEEP SKY OBJECTS PUT IN THE STAR ARCHIVE MORE THAN ONE THOUSANDS MIGHT CAUSE LAG OR NOT RECOMMEND ONE THOUSAND
-- MOBILE = 1000
-- LAPTOP = 50000
-- PC = 100000
--------------------------------------- SOUTHERN CRUX STAR PACKAGE ----------------------------------------------
wait(1)
starmap(12, 47, 43.32, -59, -41, -19.4, 352, 1.25, "B", "Mimosa")
starmap(12, 26, 35.94, -63,- 05, -56.6, 321, 1.4, "B", "Acrux")
starmap(12, 31, 9.93, -57, -6, -45.2, 88, 1.60, "M", "Gacrux")
starmap(12, 15, 8.71673, -58, -44, -56.1369, 345, 2.78, "B", "Imai")
------------------------------------------ ORION STAR PACKAGES -----------------------------------------------
starmap(05, 14, 32.27, -08, -12, -05.9, 773, 0.18, "B", "Rigel")
starmap(05, 55, 10.29, 07, 24, 25.3, 643, 0.42, "M", "Betelgeuse")
starmap(05, 25, 07.87, 06, 20, 59.0, 242, 1.64, "B", "Bellatrix")
starmap(05, 36, 12.81, -01, -12, -06.9, 1342, 1,69, "B", "Alnilam")
starmap(05, 40, 45.52, -01, -56, -33.3, 817, 1.88, "O", "Alnitak A")
starmap(05, 47, 45.39, -09, 40, 10.6, 721, 2.07, "B", "Saiph")
starmap(05, 32, 00.40, -00, -17, -56.7, 916, 2.20, "B", "Mintaka AB")
starmap(05, 35, 25.98, -05, -54, -35.6, 1325, 2.75, "O", "Iota Orionis")
--------------------------------------------TAURUS STAR PACKAGES---------------------------------------
wait(1)
starmap(04, 35, 55.20, 16, 30, 35.1, 65, 0.87, "K", "Aldebaran")
starmap(05, 26, 17.50, 28, 36, 28.3, 131, 1.65, "B", "Beta Tauri")
starmap(03, 47, 29.06, 24, 06, 18.9, 368, 2.85, "B", "Alcycone A")
starmap(05, 37, 38.68, 21, 08, 33.3, 417, 2.97, "B", "Zeta Tauri")
starmap(04, 28, 39.67, 15, 52, 15.4, 148, 3.40, "A", "Theta_2 Tauri")
starmap(04, 00, 40.82, 12, 29, 25.4, 370, 3.41, "B", "Lambda Tauri")
starmap(04, 28, 36.93, 19, 10, 49.9, 155, 3.53, "K", "Epsilon Tauri")
starmap(03, 24, 48.84, 09, 01, 44.6, 211, 3.61, "G", "Omicron Tauri")
starmap(03, 49, 09.73, 24, 03, 12.7, 380, 3.62, "B", "Atlas A")
starmap(04, 19, 47.53, 15, 37, 39.7, 154, 3.65, "G", "Gamma Tauri")
starmap(03, 44, 52.52, 24, 06, 48.4, 370, 3.72, "B", "Electra")
starmap(03, 27, 10.12, 09, 43, 58.0, 222, 3.73, "B", "Xi Tauri")
starmap(04, 22, 56.03, 17, 32, 33.3, 153, 3.77, "G", "Delta_1 Tauri")
starmap(04, 28, 34.43, 15, 57, 44.0, 158, 3.84, "G", "Theta Tauri")
starmap(03, 45, 49.59, 24, 22, 04.3, 360, 3.87, "B", "Maia")
starmap(04, 03, 09.38, 05, 59, 21.5, 129, 3.91, "A", "Nu Tauri")
starmap(03, 30, 52.37, 12, 56, 12.1, 360, 4.14, "K", "5 Tauri")
starmap(03, 46, 19.56, 23, 56, 54.5, 359, 4.14, "B", "Merope")
starmap(04, 25, 22.10, 22, 17, 38.3, 153, 4.21, "A", "Kappa Tauri")
starmap(04, 35, 39.23, 10, 09, 39.3, 150, 4.25, "A", "88 Tauri")
starmap(04, 15, 32.05, 08, 53, 32.7, 435, 4.27, "B", "Mu Tauri")
------------------------------------------CASSIOPEIA STAR PACKAGES------------------------------------------
starmap(00, 40, 30.39, 56, 32, 14.7, 228, 2.24, "K", "Schedar")
starmap(00, 09, 10.09, 59, 09, 00.8, 54, 2.28, "B", "Caph")
starmap(00, 09, 10.09, 59, 09, 00.8, 613, 2.47, "B", "Gamma Cassiopeiae")
starmap(01, 25, 48.60, 60, 14, 07.5, 99, 2.68, "A", "Delta Cassiopeiae")
starmap(01, 54, 23.68, 63, 40, 12.5, 442, 3.35, "B", "Epsilon Cassiopeiae")
starmap(00, 49, 05.10, 57, 48, 59.6, 19, 3.46, "G", "Eta Cassiopeiae")
starmap(00, 36, 58.27, 53, 53, 49.0, 597, 3.69, "B", "Zeta Cassiopeiae")
starmap(02, 03, 26.19, 72, 25, 16.5, 162, 3.95, "A", "50 Cassiopeiae")
starmap(00, 32, 59.99, 62, 55, 54.4, 4127, 4.17, "B", "Kappa Cassiopeiae")
starmap(01, 11, 05.93, 55, 08, 59.8, 137, 4.34, "A", "Theta Cassiopeiae")
starmap(02, 29, 03.99, 67, 24, 08.6, 141, 4.46, "A", "Iota Cassiopeiae")
starmap(00, 44, 43.50, 48, 17, 03.8, 906, 4.48, "B", "Omicron Cassiopeiae")
starmap(02, 01, 57.55, 70, 54, 25.4, 117, 4.49, "A", "48 Cassiopeiae")
-------------------------------------------CANCER STAR PACKAGES------------------------------------------------
wait(1)
starmap(08, 16, 30.95, 09, 11, 08.4, 240, 3.53, "K", "Beta Cancri / Tarf")
starmap(08, 44, 41.11, 18, 09, 17.5, 136, 3.94, "K", "Delta Cancri / Asellus Australis")
starmap(08, 46, 41.83, 28, 45, 36.0, 293, 4.03, "G", "Delta Cancri")
starmap(08, 58, 29.20, 11, 51, 28.0, 173, 4.26, "A", "Acubens / Sertans / Alpha Cancri" )
starmap(08, 43, 17.21, 21, 28, 06.9, 181, 4.66, "A", "Gamma Cancri / Asellus Borealis")
starmap(08, 12, 12.71, 17, 38, 53.3, 83, 4.67, "G", "Tegmine / Zeta Cancri")
starmap(08, 25, 54.79, 07, 33, 52.3, 359, 5.13, "G", "HD 71115")
starmap(08, 05, 04.51, 13, 07, 06.1, 210, 5.14, "A", "8 Cancri")
starmap(08, 20, 03.87, 27, 13, 07.0, 59, 5.14, "F", "Chi Cancri")
starmap(09, 09, 21.53, 22, 02, 43.6, 380, 5.16, "K", "Xi Cancri / Nahn")
starmap(08, 57, 14.91, 15, 19, 21.8, 160, 5.22, "A", "Omicron_2 Cancri")
starmap(08, 55, 39.69, 27, 55, 39.2, 574, 5.23, "G", "Rho_2 Cancri")
starmap(08, 59, 32.68, 32, 25, 07.1, 320, 5.23, "G", "Sigma_3 Cancri")
-------------------------------------------SCORPIUS STAR PACKAGES--------------------------------------
starmap(16, 29, 24.47, -26, -25, -55.0, 553, 0.91, "M", "Antares A" )
starmap(17, 33, 36.53, -37, -06, -13.5, 1.62, 703, "B", "Lambda Scorpii")
starmap(17, 37, 19.13, -42, -59, -52.2, 272, 1.86, "F", "Theta Scorpii")
starmap(16, 00, 20.01, -22, -37, -17.8, 401, 2.29, "B", "Delta Scorpii" )
starmap(16, 50, 10.24, -34, -17, -33.4, 65, 2.29, "K", "Epsilon Scorpii")
starmap(17, 42, 29.28, -39, -01, -47.7, 464, 2.39, "B", "Kappa Scorpii")
starmap(16, 05, 26.23, -19, -48, -19.4, 530, 2.62, "B", "Beta_1 Scorpii " )
starmap(17, 30, 45.84, -37, -17, -44.7, 518, 2.70, "B", "Upsilon Scorpii")
starmap(15, 58, 51.12, -26, -06, -50.6, 459, 2.89, "B", "Tau Scorpii")
starmap(16, 21, 11.32, -25, -35, -33.9, 734, 2.90, "B", "Sigma Scorpii")
starmap(17, 47, 35.08, -40, -07, -37.1, 1791, 2.99, "F", "Iota_1 Scorpii")
starmap(16, 51, 52.24, -38, -02, -50.4, 821, 3.00, "B", "Mu_1 Scorpii")
starmap(17, 49, 51.45, -37, -02, -36.1, 127, 3.19, "K", "G Scorpii")
starmap(17, 12, 09.18, -43, -14, -18.6, -72, 3.32, "F", "Eta Scorpii")
starmap(16, 52, 20.15, -38, -01, -02.9, 517, 3.56, "B", "Mu_2 Scorpii")
starmap(16, 54, 35.11, -42, -21, -38.7, 150, 3.62, "K", "Zeta_2 Scorpii")
starmap(15, 56, 53.09, -29, -12, -50.4, 409, 3.82, "B", "Rho Scorpii")
----------------------------------------- AURIGA STAR PACKAGES --------------------------------------------
starmap(05, 16, 41.30, 45, 59, 56.5, 42, 0.08, "G", "Capella")
starmap(05, 59, 31.77, 44, 56, 50.8, 82, 1.90, "A", "Beta Aurigae")
starmap(05, 59, 43.24, 37, 12, 46.0, 173, 2.62, "A", "Theta Aurigae")
starmap(04, 56, 59.62, 33, 09, 58.1, 512, 2.69, "K", "Iota Aurigae")
starmap(05, 01, 58.13, 43, 49, 23.9, 2037, 3.03, "F", "Epsilon Aurigae")
starmap(05, 06, 30.87, 41, 14, 04.7, 219, 3.18, "B", "Eta Aurigae")
starmap(05, 02, 28.68, 41, 04, 33.2, 787, 3.69, "K", "Zeta Aurigae")
starmap(05, 59, 31.55, 54, 17, 05.9, 140, 3.72, "K", "Delta Aurigae")
starmap(05, 51, 29.39, 39, 08, 54.5, 215, 3.97, "K", "Nu Aurigae")
starmap(05, 59, 56.10, 45, 56, 12.3, 840, 4.30, "M", "Pi Aurigae")
starmap(06, 15, 22.74, 29, 29, 55.4, 169, 4.32, "G", "Kappa Aurigae")
starmap(05, 49, 10.46, 39, 10, 52.1, 213, 4.51, "G", "Tau Aurigae")
---------------------------------------- CORONA BOREALIS PACKAGES --------------------------------------
starmap(15, 34, 41.19, 26, 42, 53.7, 75, 2.22, "A", "Alpha Coronae Borealis")
starmap(15, 27, 49.85, 29, 06, 19.8, 114, 3.66, "F", "Beta Coronae Borealis")
starmap(15, 42, 44.64, 26, 17, 43.9, 145, 3.81, "A", "Gamma Coronae Borealis")
starmap(15, 32, 55.80, 31, 21, 33.0, 311, 4.14, "B", "Theta Coronae Borealis")
starmap(15, 57, 35.30, 26, 52, 40.9, 230, 4.14, "K", "Epsilon Coronae Borealis")
starmap(16, 01, 26.59, 29, 51, 03.9, 341, 4.98, "A", "Iota Coronae Borealis")
starmap(15, 49, 35.70, 26, 04, 06.8, 165, 4.59, "G", "Delta Coronae Borealis")
------------------------------------------ LYRA STAR PACKAGES ----------------------------------------------------
starmap(18, 36, 56.19, 38, 46, 58.8, 25, 0.03, "A", "Vega")
starmap(18, 58, 56.62, 32, 41, 22.4, 634, 3.25, "B", "Gamma Lyrae")
starmap(18, 50, 04.79, 33, 21, 45.6, 881, 3.52, "A", "Beta Lyrae A")
starmap(18, 55, 20.09, 43, 56, 45.2, 349, 4.08, "M", "R Lyrae")
starmap(18, 54, 30.29, 36, 53, 55.0, 398, 4.22, "M", "Delta Lyrae")
starmap(18, 19, 51.72, 36, 03, 52.0, 238, 4.33, "K", "Kappa Lyrae")
starmap(18, 44, 46.34, 37, 36, 18.2, 154, 4.34, "A", "Zeta_1 Lyrae")
I tried to rewrite the script but the problem is still here, i expecting to working but isnt working the result is still same!! How to fix this?