Issue with Instance.new() Creation of Objects

Hello! I’m having some issues with Instance.new()!

It is likely that the issue is obvious, and I’m just simply blind.

The issue is that I have a set of lines creating Instances, but for some reason, they don’t match what it ends up making.

--Create Area for Data 3D Conversion
	local DataSavingSystem = game:GetService("ServerStorage"):WaitForChild("DataSavingCache",99999)
	local Main = Instance.new("Folder",DataSavingSystem); Main.Name = tostring(UserID)
	local DonationData = Instance.new("Folder",Main); DonationData.Name = "Donations"
	local DebugData = Instance.new("Folder",Main); DebugData.Name = "Debug"
	local PlaytimeData = Instance.new("Folder",Main); PlaytimeData.Name = "Playtime"
	local MatchtimeData = Instance.new("Folder",Main); MatchtimeData.Name = "Matchtime"
	local KnockData = Instance.new("Folder",Main); KnockData.Name = "KnockRatio"
	local StreakData = Instance.new("Folder",Main); StreakData.Name = "Streaks"
--Create Value Objects Under Folders.
	local AmountDonated = Instance.new("NumberValue",DonationData); AmountDonated.Name = "AmountDonated"
	local IsInRing = Instance.new("BoolValue",DebugData); IsInRing.Name = "IsInRing"
	local IsDead = Instance.new("BoolValue",DebugData); IsDead.Name = "IsDead"
	local AverageSessionLength = Instance.new("NumberValue",PlaytimeData); AverageSessionLength.Name = "AverageSessionLength"
	local LongestSessionLength = Instance.new("NumberValue",PlaytimeData); LongestSessionLength.Name = "LongestSessionLength"
	local MatchTimeAverage = Instance.new("NumberValue",MatchtimeData); MatchtimeData.Name = "TimeAverage"
	local KnockAverage = Instance.new("NumberValue",KnockData); KnockAverage.Name = "KnockAverage"
	local LossAverage = Instance.new("NumberValue",KnockData); LossAverage.Name = "LossAverage"
	local WinAverage = Instance.new("NumberValue",KnockData); WinAverage.Name = "WinAverage"
	local BestStreak = Instance.new("NumberValue",StreakData); BestStreak.Name = "BestStreak"
	local CurrentStreak = Instance.new("NumberValue",StreakData); CurrentStreak.Name = "CurrentStreak"

This is what it’s creating:

As you can see, the child of TimeAverage doesn’t have a name, and the folder named “Matchtime” the script should be making isn’t present.

What am I doing wrong? I’m kind of tired, so I’m assuming that’s related, and I’m just missing it.

local MatchTimeAverage = Instance.new("NumberValue",MatchtimeData); MatchtimeData.Name = "TimeAverage"

Do you see it?

Answer

You are setting MatchtimeData’s name instead of the actual value.

1 Like