I was trying to make roblox fnf game but i have issues with making some, and i cant make anything!

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? I want to make my own engine similar to friday night funkin psych engine

  2. What is the issue? I cant make the note spawn system

I have some piece of code but the numbers are mega small and it spams it alot!

for _, Section in next, songData.notes do
		for i, Note in next, Section.sectionNotes do
			local TimePosition = 0 --Note.TimePosition
			local TimeToBaseNotes = 1 / speedModifier
			local Time = TimePosition - TimeToBaseNotes
			local SectionTime = (60 / Section.bpm) * 4 print((60 / Section.bpm) * 4)
			--print(Time)
			--print(TimePosition < ((60 / Section.bpm) * 4 * 1.5))
			--if TimePosition < ((60 / Section.bpm) * 4 * 1.5) then continue end -- Chart.StartAt > 0 and  -- Chart.StartAt + Chart.SectionLength * 1.5
			print(SectionTime + Time, SectionTime, Time)
			task.delay(SectionTime + Time  , function() --(60 / Section.bpm) * 4 + Time + Chart.Offset - Chart.StartAt
				--if Chart ~= Notes.CurrentChart then return end
				warn("spawn note")
				--self:Spawn()
			end)
		end
	end

Снимок экрана 2024-11-13 212434

first of all, put this in #help-and-feedback:scripting-support, and second;

I’m not entirely sure how FNFs system works, but there is a MUCH easier system you can use, which many other rhythm games use, including one I was recreating.
(plus, from what I’ve heard FNFs system just sucks)

So first, you create a string of “map data”
How you write this is entirely up to you, I use a system like this: 0|0|0.993,0|1|1.293,2|0|1.875

Then, in code, you split the string.

local MapData = string.split(script.DataToRead.Value, ',')
table.remove(MapData, 1)
-- MapData1 is removed because that stores the AudioId in my system

Then, I run a function for each note in the map. There’s definitely better ways to do this, this is just how I did mine last year.

for Index, Value in pairs(MapData) do
	local NoteData = string.split(Value, '|')
	CreateNote(NoteData)
end

function CreateNote(NoteData)
	NoteColor += 1
	if not NoteColors[NoteColor] then NoteColor = 1 end
	local Note = script:WaitForChild("Note"):Clone()
	Note.Color = NoteColors[NoteColor]
	Note.Box.Color3 = NoteColors[NoteColor]
	local NoteX = 1.8 - (1.8 * tonumber(NoteData[1]))
	local NoteY = -1.8 + (1.8 * tonumber(NoteData[2]))
	table.insert(LoadedNotes, {["Note"] = Note; ["SpawnTime"] = NoteData[3]/1000})
	NoteData = nil
	Note.Position = Vector3.new(NoteX, NoteY, -0.042-ApproachDistance)
	Note.Parent = workspace.Notes
end

As for managing when the notes spawn, I don’t remember exactly what I did, but it works, and the code is here:

if LoadedNotes[1].SpawnTime < ApproachTime and script.OffsetMapMusic.TimePosition - script.MapMusic.TimePosition >= LoadedNotes[1].SpawnTime or LoadedNotes[1].SpawnTime >= ApproachTime and script.OffsetMapMusic.TimePosition >= LoadedNotes[1].SpawnTime then
	task.spawn(function() SpawnNote(LoadedNotes[1].Note, #LoadedNotes) end)
	table.remove(LoadedNotes, 1)
end

Then, from there I just have another function to process the notes getting hit, and the result works.
(epilepsy warning I guess)

Although, with your code, I’d imagine the issue would be in the BPM math. Again, I have zero idea how FNFs system works, I just know its bad mainly because of how it processes notes.

My understanding of BPM in charting is that its only used for creating charts, not loading them.

You could try altering your system to just use a spawn time similar to how mine does, and that should fix the issue, although you would have to rewrite all the map data to do so.

I willl try it now, and tell you thanks. Also about the where to post sorry about that. First time to post here haha…

Well it kinda doesnt really work, I kinda think because Fnf has different rhytm json files, I dont really know


It would give me errors like “unable to split table, excepted string”

yeah, again I’m not sure how FNF works, and I did mention you’d probably have to entirely redo the map data and adjust the code I shared (which was provided as an example, not a fix)

Looking at this I have zero idea what I’m looking at

However, judging by how its written, value 1 is where the note spawns in milliseconds, value 2 is where the note is, and I’m not sure what value 3 is.

As for BPM implementation, no clue on how to even begin with that, again BPM is something that should be used for charting and charting only, I have no idea why the FNF devs decided to put it into their map data.

No surprise there. Again, for the system I used to work, it needs strings, not tables.

The error you’re facing is most certainly in here, so for debug I’d look at adjusting the math.

Although, you do have Note.TimePosition greyed out, so maybe because of that its causing all the notes to stack on eachother.

2nd value i think is who sings, 3rd value should be note type if im not wrong. I will try thinking about it. thanks!