ok so, each time a player joins my game, they pick a class which I want to keep the same until they leave. I tried doing this by having a StringValue inside the starter character and setting that to whatever they choose, but then every time they die this value is reset and that's not what I want to happen lol. how would ya'll suggest doing this because I don't really know where to start?
I would add the value it serverstorage
local folder=Instance.new("Folder",game.ServerStorage) --making a folder in serverstorage folder.Name="stuff" --name the folder game.Players.PlayerAdded:Connect(function(player) local stat=Instance.new("StringValue",folder) stat.Name=player.Name --sets the name of the string value to the players name end) --remove value when player leaves game.Players.PlayerRemoving:Connect(function(player) local stat=folder:FindFirstChild(player) --if player has stats then if stat then stat:Destroy() end end)
to find a players stat
local folder=game.ServerStorage:WaitForChild("foldername") --change name of folder to the name of the folder local stat=folder:FindFirstChild(player) if stat then --has stats else --no stats end
hope this helps