I have the error W001: Unknow global 'Player'?
I've been trying to make a Save Data system (If someone could help me with that too) because any of what i've tryied worked then i tryied with some YT videos and while i was copying the script (I write them) i saw this error, the script is..
- local Pitote = game:GetService("DataStoreService"):GetDataStore("Pitote")
- local Pito = Pitote:GetDataStore("Condon")
- game.Players.PlayerAdded:Connect(function(Player)
- local Piernas = Instance.new("Folder", Player)
- Piernas.Name = "leaderstats"
- local Coins = Instance.new("IntValue", Player)
- Coins.Name = "Coins"
- Coins.Value = Pito:GetAsync(Player.UserId) or 0
- Coins.Changed:Connect(function()
- Pito:SetAsync(Player.UserId, Coins.Value)
- end)
- end)
- game.Player.PlayerRemoving:Connect(function()
- Pito:SetAsync(Player.UserId, Player.Piernas.Coins.Value)
- end)
The error ocurrs on line 17 "(Player.UserId and Player.Piernas)"
Any help?