Right. Roblox has plans to depreciate the SetWaypoint function for ChangeHistoryService in a few months, and I’m completely confused on how to use the new recording feature. I’ve tried implementing it in an auroraSuite tool, and every single time no matter what, I get an error being ‘unable to cast null to token’.
I never had any problems using SetWaypoint before, but I really need help in understanding why I’m experiencing it. Every time I run into the error, I literally have to open another place or template, since the script won’t run, even if I make changes to it and save my plugin again.
script.Parent.MouseButton1Click:Connect(function()
local st = script.Parent.Parent.StartBox
local samt = script.Parent.Parent.IntervalBox
local chs = game:GetService("ChangeHistoryService")
local tag = game:GetService("CollectionService")
if st.Text == "" then
error("auroraSuite: Unable to create day/night cycle due to not having any integer values in some textboxes.")
elseif samt.Text == "" then
error("auroraSuite: Unable to create day/night cycle due to not having any integer values in some textboxes.")
elseif game.ServerScriptService:FindFirstChild("DayAndNightScript") then
warn("auroraSuite: A day/night cycle script was already found, and we're unable to edit the existing one. Try deleting the existing one first.")
else
local record = chs:TryBeginRecording("auroraSuite: Day Night Cycle")
if record then
local sc = Instance.new("Script")
sc.Parent = game.ServerScriptService
sc.Name = "DayAndNightScript"
sc.Source = 'local minutesAfterMidnight = ' .. st.Text ..
'\n while true do \n' ..
'game.Lighting:SetMinutesAfterMidnight(minutesAfterMidnight) \n' ..
'minutesAfterMidnight = minutesAfterMidnight + 1 \n' ..
'task.wait(' .. samt.Text .. ') \n' ..
'end'
tag:AddTag(sc, "auroraSuite-generated")
chs:FinishRecording(record, Enum.FinishRecordingOperation)
end
if plugin:GetSetting("DebugMode") == true then
print("auroraSuite: Made day and night cycle successfully in game.ServerScriptService.")
plugin:OpenScript(game.ServerScriptService.DayAndNightScript)
end
end
end)
20:54:32.516 Unable to cast null to token - Edit - Script:28
20:54:32.517 Stack Begin - Studio
20:54:32.517 Script 'user_aurorasuite.rbxmx.aurorasuite.UI.ScrollingFrame.DayNightCycleOpen.TextButton.Script', Line 28 - Studio - Script:28
20:54:32.517 Stack End - Studio