Hello, I’m trying to make a chart editor but the script can’t create notes because TimePosition isn’t working, when I tried printing TimePosition it just printed 0 when it started playing
Code:
Song:Play()
Song:GetPropertyChangedSignal("TimePosition"):Connect(function()
print(Song.TimePosition)
if Song.TimePosition == game.ReplicatedStorage["Gloo Gloo"][NoteNumber].Value then
local RandomButton = math.random(2, #GameFrame:GetChildren())
CreateNote(GameFrame:GetChildren()[RandomButton], 0.5)
NoteNumber = NoteNumber + 1
end
end)
i think it’s due to the fact time positions have decimals and it will count decimals, since it is in the local script it will print even faster which can cause the whole script to lag like crazy, you should add some dividers i think which distances individual print positions like adding “x” by 1 every print and if it hits 50 it will reset then print it
this is probably to avoid lagging and killing the server’s output thingy
roblox does not let you connect events to timeposition for some reason
so you can use heartbeat instead
local Song = script.Parent
Song:Play()
game:GetService("RunService").Heartbeat:Connect(function()
if Song.Playing == true then
print(Song.TimePosition)
end
end)
you can math.floor if u dont want decimals too, and you can disconnect if the song stopped playing if u dont want it to keep on printing