i don’t care if the star was too many ;-;
-
What do you want to achieve? Keep it simple and clear!
The goal is the script must create all parts or stars in the raw csv link not in just slices like cake (can’t show it but i can help you find it here : search on google then type HYG database github then find the one with word “current version” then you are in github click hyg file not athyg then click v2 not v3 (v3 is too big) then click hygfull.csv one you will saw this blue text “view raw” and you CLICK IT! this raw is the link for my script) -
What is the issue? Include screenshots / videos if possible!
The issue is in the title. Here is the details the script is creating part but a portions of it and it make it look like a slices like a cake. -
What solutions have you tried so far? Did you look for solutions on the Developer Hub? Yes, also tried to ask AI chatgpt and I tried to find solutions in Devforum and others
This the script and its location is in ServerScriptService
-- convert csv to lua. This is similiar to JSONDecode() but CSVDecode() found this at the website somewhere . . .
function ParseCSVLine(line, sep)
local res = {}
local pos = 1
sep = sep or ','
while true do
local c = string.sub(line, pos, pos)
if c == '' then
break
end
if c == '"' then
local txt = ''
repeat
local startp, endp = string.find(line, '^%b""', pos)
txt = txt .. string.sub(line, startp + 1, endp - 1)
pos = endp + 1
c = string.sub(line, pos, pos)
if c == '"' then
txt = txt .. '"'
end
until c ~= '"'
table.insert(res, txt)
assert(c == sep or c == '')
pos = pos + 1
else
local startp, endp = string.find(line, sep, pos)
if startp then
table.insert(res, string.sub(line, pos, startp - 1))
pos = endp + 1
else
table.insert(res, string.sub(line, pos))
break
end
end
end
return res
end
-- get the httpservice
local HttpService = game:GetService("HttpService")
-- fetch the data
local function fetchData()
local success, result = pcall(function()
return HttpService:GetAsync("I can't show because if i show it to you I can t craete this topic")
end)
if success then
-- if the fetchdata is working then create the stars
local starList = {}
local isFirstLine = true
for line in result:gmatch("[^\r\n]+") do
if isFirstLine then
isFirstLine = false
else
local parsedData = ParseCSVLine(line)
-- finally we can create stars
local ra, dec, distance = parsedData[8], parsedData[9], parsedData[10]
local X = (distance * math.cos(math.rad(dec))) * math.cos(math.rad(ra))
local Y = (distance * math.cos(math.rad(dec))) * math.sin(math.rad(ra))
local Z = distance * math.sin(math.rad(dec))
local star = Instance.new("Part", workspace)
star.Anchored = true
star.Shape = Enum.PartType.Ball
star.Position = Vector3.new(X*2, Y*2, Z*2)
end
end
else
-- if it failed print what it causes
print("Failed to fetch data:", result)
end
end
-- e
fetchData()
I don’t know where is the problem i believe is coming from this script? Idk ;-;