idk why but the playeradded event don t fire, its located in ServerScriptService and its a server script. i tried different times on reworking the function but it still do nt fire in both game and studio.
Edit: i tested alot of things and found out that the code stop when i require the upgrade manager so now im looking to fix this
-- Services
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ServerScriptService = game:GetService("ServerScriptService")
local Players = game:GetService("Players")
-- Modules
local ModuleScripts = ReplicatedStorage.Modules
local GameSettings = require(ModuleScripts.GameSettings)
local PlayerManagement = ServerScriptService.PlayerManagement
local PlayerManagementModules = PlayerManagement.ModuleScripts
local Data = ServerScriptService.Data
local DataStore = require(Data.Modules.DataStore)
local UpgradeManager = require(Data.Modules.UpgradeManager)
-- Local Functions
local function setupPlayerStats(player)
local character = player.Character or player.CharacterAdded:wait()
local humanoid = character:WaitForChild("Humanoid")
local LeaderStats = Instance.new("Folder",player)
LeaderStats.Name = "leaderstats"
local OtherStats = Instance.new("Folder",player)
OtherStats.Name = "OtherStats"
local Money = Instance.new("IntValue",LeaderStats)
Money.Name = "Money"
local Reborn = Instance.new("IntValue",LeaderStats)
Reborn.Name = "Reborn"
local Cropfarmed = Instance.new("IntValue",LeaderStats)
Cropfarmed.Name = "Crop Farmed"
local Vip = Instance.new("BoolValue",OtherStats)
Vip.Name = "Vip"
local Donator = Instance.new("BoolValue",OtherStats)
Donator.Name = "Donator"
local Tutorial = Instance.new("BoolValue",OtherStats)
Tutorial.Name = "Tutorial"
local Pets = Instance.new("Folder",OtherStats)
Pets.Name = "Pets"
local Wheat = Instance.new("IntValue",OtherStats)
Wheat.Name = "Wheat"
local Carrots = Instance.new("IntValue",OtherStats)
Carrots.Name = "Carrots"
local Potatoes = Instance.new("IntValue",OtherStats)
Potatoes.Name = "Potatoes"
local Multyplier = Instance.new("IntValue",OtherStats)
Multyplier.Name = "Multyplier"
print("work")
UpgradeManager:Update(player)
end
Players.PlayerAdded:Connect(setupPlayerStats)

5 comments
check if it errors
No errors related to this script ,the only errors i get are the one that do nt find the objects that this script make
Posted a answer
Accept yHasteeD answer if it answered your question. Do it by pressing the accept button below his answer.
read comments of the answer