local players = game:GetService("Players")
local Replicatedstorage = game:GetService("ReplicatedStorage")
local dataManager = require(script.Parent:WaitForChild("Module"):WaitForChild("dataManager"))
local ChangeCharacter = Replicatedstorage:WaitForChild("remortes"):WaitForChild("changeCharacter")
local characterModule = require(Replicatedstorage:WaitForChild("Module"):WaitForChild("CharactersModule"))
players.PlayerAdded:Connect(function(player)
local character = characterModule.GetCharacter(player)
print(character)
end)
ChangeCharacter.OnServerEvent:connect(function(player, character)
if player and character then
local profile = dataManager.Profiles[player]
if Replicatedstorage:WaitForChild("Module"):WaitForChild("CharactersModule"):WaitForChild("characters"):FindFirstChild(character) then
profile.Data.SelectedCharacter = character
player:waitForChild("SelectedCharacter").Value = profile.Data.SelectedCharacter
end
end
end)