Im not sure why it isn't working but all I know that it isn't. Im trying to learn Lua so I'd really like some help!
01 | local DataStoreService = game:GetService( "DataStoreService" ) |
02 |
03 | local myDataStore = DataStoreService:GetDataStore( "myDataStore" ) |
04 |
05 | game.Players.PlayerAdded:Connect( function (player) |
06 | local leaderstats = Instance.new( "Folder" ) |
07 | leaderstats.Name = "leaderstats" |
08 | leaderstats.Parent = player |
09 |
10 | local cash = Instance.new( "IntValue" ) |
11 | cash.Name = "Cash" |
12 | cash.Parent = leaderstats |
13 |
14 | local data |
15 | local sucess, errormessage = pcall ( function () |
If this answer helped you please make sure you accept it!
Your first problem in the script is this part:
1 | game.StarterGui.ScreenGui.TextLabel.Visible = not "TextLabel" Visible |
Because of this the whole script breaks.
You can't just put "TextLabel" and expect the script the know that is without using a local term.
It should work if you use this.
1 | game.StarterGui.ScreenGui.TextLabel.Visible = not game.StarterGui.ScreenGui.TextLabel.Visible |
The second problem is that you need 2 ends:
1 | if sucess then |
2 | cash.Value = data |
3 | else |
4 | print ( "There was an error whilst getting your data" ) |
5 | game.StarterGui.ScreenGui.TextLabel.Visible = not game.StarterGui.ScreenGui.TextLabel.Visible |
6 | end -- First one here, without ")" |
7 | end ) -- Second one here, with ")" |