Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

My script's end on line 24 isn't working, it says it is a fail but I'm not sure what to do?

Asked by 5 years ago
Edited 5 years ago

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!

01local DataStoreService = game:GetService("DataStoreService")
02 
03local myDataStore = DataStoreService:GetDataStore("myDataStore")
04 
05game.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()
View all 39 lines...
0
get rid of the ) on the end on line 24. ForeverBrown 356 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

If this answer helped you please make sure you accept it!

Your first problem in the script is this part:

1game.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.

1game.StarterGui.ScreenGui.TextLabel.Visible = not game.StarterGui.ScreenGui.TextLabel.Visible

The second problem is that you need 2 ends:

1if 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 ")"
0
When you put it in the script, it makes it so not and game are next to each other, is that correct? Also i also wan tot know what the difference is between an end without a ")" and an end with a ")" so I can learn and use it later in scripting please. Used_Develop 14 — 5y
0
Also, the ScreenGui is only supposed to show up when the loading fails, it is basically saying "Your save didn't load, please rejoin". I know I should put a then or else somewhere to lead to it opening the gui only if it fails loading. Just not sure where to place it. Used_Develop 14 — 5y
Ad

Answer this question