Problem with Instance.new("")

Hey, I am having a problem with this script, it will instance only some of the supposed things in the stats folder but all others won’t.

function ffc(parent, item)
	local obj = parent:FindFirstChild(item) or parent:WaitForChild(item)
	return obj
end

--[[function newInstance(obj, name)
	local instance = Instance.new(obj)
	instance.Name = name
	return instance
end]]--

--// SERVICES
local Players = game:GetService("Players")
local MarketPlaceService = game:GetService("MarketplaceService")
local HTTPService = game:GetService("HttpService")
local SocialService = game:GetService("SocialService")
local BadgeService = game:GetService("BadgeService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ServerStorage = game:GetService("ServerStorage")
local MessagingService = game:GetService("MessagingService")

--// VARIABLES
local Events = ffc(ReplicatedStorage, "Events")

--// EVENTS
local Add = ffc(Events, "Add")
local BuyCamera = ffc(Events, "BuyCamera")
local DataLoad = ffc(Events, "DataLoad")
local BuyDoor = ffc(Events, "BuyDoor")
local BuyPet = ffc(Events, "BuyPet")
local DoorAlreadyBought = ffc(Events, "DoorAlreadyBought")
local EggNotification = ffc(Events, "EggNotification")
local Rebirth = ffc(Events, "Rebirth")
local AwardPhotoBadges = ffc(Events, "AwardPhotoBadges")
local PremiumCamera = ffc(Events, "PremiumCamera")
local RobuxCameraAdd = ffc(Events, "RobuxCameraAdd")
local BuyEgg = ffc(Events, "BuyEgg")
local EquipPet = ffc(Events, "EquipPet")

--// MODULES
local CameraModule = require(ReplicatedStorage.Modules.CameraModule)
local PetInfoModule = require(game.ReplicatedStorage.Modules.PetInfo)
local HatInfoModule = require(game.ReplicatedStorage.Modules.HatInfo)



Players.PlayerAdded:Connect(function(Player)
	Player.CharacterAdded:Wait()
	wait(1)
	local leaderstats = Instance.new("Folder")
	leaderstats.Name = "leaderstats"
	leaderstats.Parent = Player
	
	local Stats = Instance.new("Folder")
	Stats.Name = "Stats"
	Stats.Parent = Player
	
	local Coins = Instance.new("NumberValue")
	Coins.Name = "Coins"
	Coins.Value = 0
	Coins.Parent = leaderstats	
	print("a")
	local Rebirths = Instance.new("IntValue")
	Rebirths.Name = "Rebirths"
	Rebirths.Value = 0
	Rebirths.Parent = leaderstats	
	
	local TotalPhotos = Instance.new("NumberValue")
	TotalPhotos.Name = "Total Photos"
	TotalPhotos.Value = 0
	TotalPhotos.Parent = leaderstats
	 
	local EquippedCamera = Instance.new("StringValue")
	EquippedCamera.Name = "EquippedCamera"
	EquippedCamera.Value = "Ro-Phone 2"
	EquippedCamera.Parent = Stats
	
	local ExtraValues = Instance.new("NumberValue")
	ExtraValues.Name = "ExtraValues" -- for photos
	ExtraValues.Value = 2
	ExtraValues.Parent = Stats
	
	local PetBoost = Instance.new("NumberValue")
	PetBoost.Name = "PetBoost" -- for photos
	PetBoost.Value = 0
	PetBoost.Parent = Stats
	
	local PetBoost = Instance.new("Vector3Value")
	PetBoost.Name = "PetBoost" -- for photos
	PetBoost.Value = 0
	PetBoost.Parent = Stats
	
	local HatBoost = Instance.new("NumberValue")
	HatBoost.Name = "HatBoost"
	HatBoost.Value = 1
	HatBoost.Parent = Stats
	
	local GroupBoost = Instance.new("BoolValue")
	GroupBoost.Name = "GroupBoost"
	GroupBoost.Value = false
	GroupBoost.Parent = Stats

	local WorldBoost = Instance.new("IntValue")
	WorldBoost.Name = "WorldBoost"
	WorldBoost.Value = 1
	WorldBoost.Parent = Stats
	
	local ExtraCoins = Instance.new("NumberValue")
	ExtraCoins.Name = "ExtraCoins"
	ExtraCoins.Value = 1
	ExtraCoins.Parent = Stats
	
	local ExtraGems = Instance.new("NumberValue")
	ExtraGems.Name = "ExtraGems"
	ExtraGems.Value = 1
	ExtraGems.Parent = Stats
	
	local Cooldown = Instance.new("NumberValue")
	Cooldown.Name = "Cooldown"
	Cooldown.Value = 1.5
	Cooldown.Parent = Stats
	
	local EquippedPet = Instance.new("StringValue")
	EquippedPet.Name = "EquippedPet"
	EquippedPet.Parent = Stats
	
	local EquippedHat = Instance.new("StringValue")
	EquippedHat.Name = "EquippedHat"
	EquippedHat.Parent = Stats
	
	local CurrentPhotos = Instance.new("NumberValue")
	CurrentPhotos.Name = "CurrentPhotos"
	CurrentPhotos.Value = 0
	CurrentPhotos.Parent = Stats
	
	local ExtraHearts = Instance.new("NumberValue")
	ExtraHearts.Name = "ExtraHearts"
	ExtraHearts.Value = 1
	ExtraHearts.Parent = Stats
	
	local ExtraRocks = Instance.new("NumberValue")
	ExtraRocks.Name = "ExtraRocks"
	ExtraRocks.Value = 1
	ExtraRocks.Parent = Stats
	
	local Gems = Instance.new("NumberValue")
	Gems.Name = "Gems"
	Gems.Value = 0
	Gems.Parent = Stats
	
	local Hearts = Instance.new("NumberValue")
	Hearts.Name = "Hearts"
	Hearts.Value = 0
	Hearts.Parent = Stats
	
	local Rocks = Instance.new("NumberValue")
	Rocks.Name = "Rocks"
	Rocks.Value = 0
	Rocks.Parent = Stats
	
	local KeyFolder = Instance.new("Folder")
	KeyFolder.Name = "KeyFolder"
	KeyFolder.Parent = Player
	
	local BronzeKey = Instance.new("IntValue")
	BronzeKey.Name = "BronzeKey"
	BronzeKey.Value = 0
	BronzeKey.Parent = KeyFolder
	
	local Merchant = Instance.new("Folder")
	Merchant.Name = "Merchant"
	Merchant.Parent = Player
	
	local IsBanned = Instance.new("BoolValue")
	IsBanned.Name = "IsBanned"
	IsBanned.Value = false
	IsBanned.Parent = Player
	
	local BannedReason = Instance.new("StringValue")
	BannedReason.Name = "BannedReason"
	BannedReason.Value = ""
	BannedReason.Parent = Player
	
	print("Initialized")
end)
2 Likes
function ffc(parent, item)
	local obj = parent:FindFirstChild(item) or parent:WaitForChild(item)
	return obj
end

--[[function newInstance(obj, name)
	local instance = Instance.new(obj)
	instance.Name = name
	return instance
end]]--

--// SERVICES
local Players = game:GetService("Players")
local MarketPlaceService = game:GetService("MarketplaceService")
local HTTPService = game:GetService("HttpService")
local SocialService = game:GetService("SocialService")
local BadgeService = game:GetService("BadgeService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ServerStorage = game:GetService("ServerStorage")
local MessagingService = game:GetService("MessagingService")

--// VARIABLES
local Events = ffc(ReplicatedStorage, "Events")

--// EVENTS
local Add = ffc(Events, "Add")
local BuyCamera = ffc(Events, "BuyCamera")
local DataLoad = ffc(Events, "DataLoad")
local BuyDoor = ffc(Events, "BuyDoor")
local BuyPet = ffc(Events, "BuyPet")
local DoorAlreadyBought = ffc(Events, "DoorAlreadyBought")
local EggNotification = ffc(Events, "EggNotification")
local Rebirth = ffc(Events, "Rebirth")
local AwardPhotoBadges = ffc(Events, "AwardPhotoBadges")
local PremiumCamera = ffc(Events, "PremiumCamera")
local RobuxCameraAdd = ffc(Events, "RobuxCameraAdd")
local BuyEgg = ffc(Events, "BuyEgg")
local EquipPet = ffc(Events, "EquipPet")

--// MODULES
local CameraModule = require(ReplicatedStorage.Modules.CameraModule)
local PetInfoModule = require(game.ReplicatedStorage.Modules.PetInfo)
local HatInfoModule = require(game.ReplicatedStorage.Modules.HatInfo)




Players.PlayerAdded:Connect(function(Player)
	Player.CharacterAdded:Wait()
	wait(1)
	local leaderstats = Instance.new("Folder")
	leaderstats.Name = "leaderstats"
	leaderstats.Parent = Player

	local Stats = Instance.new("Folder")
	Stats.Name = "Stats"
	Stats.Parent = Player

	local Coins = Instance.new("NumberValue")
	Coins.Name = "Coins"
	Coins.Value = 0
	Coins.Parent = leaderstats	
	print("a")
	local Rebirths = Instance.new("IntValue")
	Rebirths.Name = "Rebirths"
	Rebirths.Value = 0
	Rebirths.Parent = leaderstats	

	local TotalPhotos = Instance.new("NumberValue")
	TotalPhotos.Name = "Total Photos"
	TotalPhotos.Value = 0
	TotalPhotos.Parent = leaderstats

	local EquippedCamera = Instance.new("StringValue")
	EquippedCamera.Name = "EquippedCamera"
	EquippedCamera.Value = "Ro-Phone 2"
	EquippedCamera.Parent = Stats

	local ExtraValues = Instance.new("NumberValue")
	ExtraValues.Name = "ExtraValues" -- for photos
	ExtraValues.Value = 2
	ExtraValues.Parent = Stats

	local PetBoost = Instance.new("NumberValue")
	PetBoost.Name = "PetBoost" -- for photos
	PetBoost.Value = 0
	PetBoost.Parent = Stats
	
	local HatBoost = Instance.new("NumberValue")
	HatBoost.Name = "HatBoost"
	HatBoost.Value = 1
	HatBoost.Parent = Stats

	local GroupBoost = Instance.new("BoolValue")
	GroupBoost.Name = "GroupBoost"
	GroupBoost.Value = false
	GroupBoost.Parent = Stats

	local WorldBoost = Instance.new("IntValue")
	WorldBoost.Name = "WorldBoost"
	WorldBoost.Value = 1
	WorldBoost.Parent = Stats

	local ExtraCoins = Instance.new("NumberValue")
	ExtraCoins.Name = "ExtraCoins"
	ExtraCoins.Value = 1
	ExtraCoins.Parent = Stats

	local ExtraGems = Instance.new("NumberValue")
	ExtraGems.Name = "ExtraGems"
	ExtraGems.Value = 1
	ExtraGems.Parent = Stats

	local Cooldown = Instance.new("NumberValue")
	Cooldown.Name = "Cooldown"
	Cooldown.Value = 1.5
	Cooldown.Parent = Stats

	local EquippedPet = Instance.new("StringValue")
	EquippedPet.Name = "EquippedPet"
	EquippedPet.Parent = Stats

	local EquippedHat = Instance.new("StringValue")
	EquippedHat.Name = "EquippedHat"
	EquippedHat.Parent = Stats

	local CurrentPhotos = Instance.new("NumberValue")
	CurrentPhotos.Name = "CurrentPhotos"
	CurrentPhotos.Value = 0
	CurrentPhotos.Parent = Stats

	local ExtraHearts = Instance.new("NumberValue")
	ExtraHearts.Name = "ExtraHearts"
	ExtraHearts.Value = 1
	ExtraHearts.Parent = Stats

	local ExtraRocks = Instance.new("NumberValue")
	ExtraRocks.Name = "ExtraRocks"
	ExtraRocks.Value = 1
	ExtraRocks.Parent = Stats

	local Gems = Instance.new("NumberValue")
	Gems.Name = "Gems"
	Gems.Value = 0
	Gems.Parent = Stats

	local Hearts = Instance.new("NumberValue")
	Hearts.Name = "Hearts"
	Hearts.Value = 0
	Hearts.Parent = Stats

	local Rocks = Instance.new("NumberValue")
	Rocks.Name = "Rocks"
	Rocks.Value = 0
	Rocks.Parent = Stats

	local KeyFolder = Instance.new("Folder")
	KeyFolder.Name = "KeyFolder"
	KeyFolder.Parent = Player

	local BronzeKey = Instance.new("IntValue")
	BronzeKey.Name = "BronzeKey"
	BronzeKey.Value = 0
	BronzeKey.Parent = KeyFolder

	local Merchant = Instance.new("Folder")
	Merchant.Name = "Merchant"
	Merchant.Parent = Player

	local IsBanned = Instance.new("BoolValue")
	IsBanned.Name = "IsBanned"
	IsBanned.Value = false
	IsBanned.Parent = Player

	local BannedReason = Instance.new("StringValue")
	BannedReason.Name = "BannedReason"
	BannedReason.Value = ""
	BannedReason.Parent = Player

	print("Initialized")
end)

You put a Vector3Value instead of a NumberValue

Screen Shot 2021-07-21 at 1.50.35 PM

Here is the fixed script

function ffc(parent, item)
	local obj = parent:FindFirstChild(item) or parent:WaitForChild(item)
	return obj
end

--[[function newInstance(obj, name)
	local instance = Instance.new(obj)
	instance.Name = name
	return instance
end]]--

--// SERVICES
local Players = game:GetService("Players")
local MarketPlaceService = game:GetService("MarketplaceService")
local HTTPService = game:GetService("HttpService")
local SocialService = game:GetService("SocialService")
local BadgeService = game:GetService("BadgeService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ServerStorage = game:GetService("ServerStorage")
local MessagingService = game:GetService("MessagingService")

--// VARIABLES
local Events = ffc(ReplicatedStorage, "Events")

--// EVENTS
local Add = ffc(Events, "Add")
local BuyCamera = ffc(Events, "BuyCamera")
local DataLoad = ffc(Events, "DataLoad")
local BuyDoor = ffc(Events, "BuyDoor")
local BuyPet = ffc(Events, "BuyPet")
local DoorAlreadyBought = ffc(Events, "DoorAlreadyBought")
local EggNotification = ffc(Events, "EggNotification")
local Rebirth = ffc(Events, "Rebirth")
local AwardPhotoBadges = ffc(Events, "AwardPhotoBadges")
local PremiumCamera = ffc(Events, "PremiumCamera")
local RobuxCameraAdd = ffc(Events, "RobuxCameraAdd")
local BuyEgg = ffc(Events, "BuyEgg")
local EquipPet = ffc(Events, "EquipPet")

--// MODULES
local CameraModule = require(ReplicatedStorage.Modules.CameraModule)
local PetInfoModule = require(game.ReplicatedStorage.Modules.PetInfo)
local HatInfoModule = require(game.ReplicatedStorage.Modules.HatInfo)



Players.PlayerAdded:Connect(function(Player)
	Player.CharacterAdded:Wait()
	wait(1)
	local leaderstats = Instance.new("Folder")
	leaderstats.Name = "leaderstats"
	leaderstats.Parent = Player
	
	local Stats = Instance.new("Folder")
	Stats.Name = "Stats"
	Stats.Parent = Player
	
	local Coins = Instance.new("NumberValue")
	Coins.Name = "Coins"
	Coins.Value = 0
	Coins.Parent = leaderstats	
	print("a")
	local Rebirths = Instance.new("IntValue")
	Rebirths.Name = "Rebirths"
	Rebirths.Value = 0
	Rebirths.Parent = leaderstats	
	
	local TotalPhotos = Instance.new("NumberValue")
	TotalPhotos.Name = "Total Photos"
	TotalPhotos.Value = 0
	TotalPhotos.Parent = leaderstats
	 
	local EquippedCamera = Instance.new("StringValue")
	EquippedCamera.Name = "EquippedCamera"
	EquippedCamera.Value = "Ro-Phone 2"
	EquippedCamera.Parent = Stats
	
	local ExtraValues = Instance.new("NumberValue")
	ExtraValues.Name = "ExtraValues" -- for photos
	ExtraValues.Value = 2
	ExtraValues.Parent = Stats
	
	local PetBoost = Instance.new("NumberValue")
	PetBoost.Name = "PetBoost" -- for photos
	PetBoost.Value = 0
	PetBoost.Parent = Stats
	
	local PetBoost = Instance.new("NumberValue")
	PetBoost.Name = "PetBoost" -- for photos
	PetBoost.Value = 0
	PetBoost.Parent = Stats
	
	local HatBoost = Instance.new("NumberValue")
	HatBoost.Name = "HatBoost"
	HatBoost.Value = 1
	HatBoost.Parent = Stats
	
	local GroupBoost = Instance.new("BoolValue")
	GroupBoost.Name = "GroupBoost"
	GroupBoost.Value = false
	GroupBoost.Parent = Stats

	local WorldBoost = Instance.new("IntValue")
	WorldBoost.Name = "WorldBoost"
	WorldBoost.Value = 1
	WorldBoost.Parent = Stats
	
	local ExtraCoins = Instance.new("NumberValue")
	ExtraCoins.Name = "ExtraCoins"
	ExtraCoins.Value = 1
	ExtraCoins.Parent = Stats
	
	local ExtraGems = Instance.new("NumberValue")
	ExtraGems.Name = "ExtraGems"
	ExtraGems.Value = 1
	ExtraGems.Parent = Stats
	
	local Cooldown = Instance.new("NumberValue")
	Cooldown.Name = "Cooldown"
	Cooldown.Value = 1.5
	Cooldown.Parent = Stats
	
	local EquippedPet = Instance.new("StringValue")
	EquippedPet.Name = "EquippedPet"
	EquippedPet.Parent = Stats
	
	local EquippedHat = Instance.new("StringValue")
	EquippedHat.Name = "EquippedHat"
	EquippedHat.Parent = Stats
	
	local CurrentPhotos = Instance.new("NumberValue")
	CurrentPhotos.Name = "CurrentPhotos"
	CurrentPhotos.Value = 0
	CurrentPhotos.Parent = Stats
	
	local ExtraHearts = Instance.new("NumberValue")
	ExtraHearts.Name = "ExtraHearts"
	ExtraHearts.Value = 1
	ExtraHearts.Parent = Stats
	
	local ExtraRocks = Instance.new("NumberValue")
	ExtraRocks.Name = "ExtraRocks"
	ExtraRocks.Value = 1
	ExtraRocks.Parent = Stats
	
	local Gems = Instance.new("NumberValue")
	Gems.Name = "Gems"
	Gems.Value = 0
	Gems.Parent = Stats
	
	local Hearts = Instance.new("NumberValue")
	Hearts.Name = "Hearts"
	Hearts.Value = 0
	Hearts.Parent = Stats
	
	local Rocks = Instance.new("NumberValue")
	Rocks.Name = "Rocks"
	Rocks.Value = 0
	Rocks.Parent = Stats
	
	local KeyFolder = Instance.new("Folder")
	KeyFolder.Name = "KeyFolder"
	KeyFolder.Parent = Player
	
	local BronzeKey = Instance.new("IntValue")
	BronzeKey.Name = "BronzeKey"
	BronzeKey.Value = 0
	BronzeKey.Parent = KeyFolder
	
	local Merchant = Instance.new("Folder")
	Merchant.Name = "Merchant"
	Merchant.Parent = Player
	
	local IsBanned = Instance.new("BoolValue")
	IsBanned.Name = "IsBanned"
	IsBanned.Value = false
	IsBanned.Parent = Player
	
	local BannedReason = Instance.new("StringValue")
	BannedReason.Name = "BannedReason"
	BannedReason.Value = ""
	BannedReason.Parent = Player
	
	print("Initialized")
end)

Thank you so much! You helped me a lot!

You’re welcome! :smile: :smile: