So, I have begun to make a character customization system for my game. The problem is that I feel like I could make it more simple/clean. Below is the start I have; any help would be appreciated!
local DSS = game:GetService("DataStoreService"):GetDataStore("DemonSlayer")
local ServerScriptService = game:GetService("ServerScriptService")
local hNext = game.ReplicatedStorage:WaitForChild("hNext")
local hBack = game.ReplicatedStorage:WaitForChild("hBack")
game.Players.PlayerAdded:Connect(function(player)
--Hair
hNext.OnServerEvent:Connect(function(player)
print("test")
player:WaitForChild("Data"):WaitForChild("Hair").Value = player:WaitForChild("Data"):WaitForChild("Hair").Value + 1
---------------------------------------------------------------------
if player:WaitForChild("Data"):WaitForChild("Hair").Value == 0 then
local hair = game.ServerScriptService.Hair.Hair2:Clone()
hair.Parent = player.Character
end
if player:WaitForChild("Data"):WaitForChild("Hair").Value == 1 then
local hair = game.ServerScriptService.Hair.Hair1:Clone()
hair.Parent = player.Character
end
end)
hBack.OnServerEvent:Connect(function(player)
print("test")
player:WaitForChild("Data"):WaitForChild("Hair").Value = player:WaitForChild("Data"):WaitForChild("Hair").Value - 1
end)
end)