So what I am trying to do here is load a players 'Body Colors' using a Int value, It all works apart from line 6, it gives this error code out:
error code: Workspace.Game.Player_Edit.Player_Config.Player_Importer:6: attempt to index field 'Character' (a nil value)
game.Players.PlayerAdded:connect(function(player)
local Name = player.Name
local Player_Configs = player:WaitForChild("Player_Configs")
local Skin_Tone = Player_Configs.Skin_Tone.Value
local Copy = workspace.Game.Player_Edit.Player_Config.Skin_Tone:FindFirstChild(Skin_Tone)["Body Colors"]:Clone()
player.Character:WaitForChild("Body Colors"):Destroy()
Copy.Parent = player.Character
print("Player Loaded")
end)
I decided to add a wait for 'Character' to see if that would work this is the error this gave: Infinite yield possible on 'Players.PastTests:WaitForChild("Character")'
game.Players.PlayerAdded:connect(function(player)
local Name = player.Name
local Player_Configs = player:WaitForChild("Player_Configs")
local Skin_Tone = Player_Configs.Skin_Tone.Value
local Char = player:WaitForChild("Character")
local Copy = workspace.Game.Player_Edit.Player_Config.Skin_Tone:FindFirstChild(Skin_Tone)["Body Colors"]:Clone()
Char:WaitForChild("Body Colors"):Destroy()
Char = player.Character
print("Player Loaded")
end)

7 comments
Did you forget to change :connect() to :Connect() on line 1 of the fixed script?
Oh, thanks for warn
Ok, so it seems to be working fine thank you, but i'm now just having trouble getting my Data Store to work, So many problems appear out of no where
What is errors in your data store?
Ok so i figured it out, I was editing the Value of the 'Skin_Tone' Via a Local script in a GUI but OBVIOUSLY that means the server script isnt seeing the change, how would i change the value with a gui that a local script can see? events?
use RemoteEvents, if you need help with RemoteEvent create another question. but you can see here of RemoteEvents: https://wiki.roblox.com/index.php?title=Remote_Functions_%26_Events
Ok thank you for the continued support ill will look into it!