[FIXED]What's wrong with my Script?[FIXED}
So here's the tree pointing to the location of the script if helpful:
==Workspace==
==Automated==
-Game(Script)-
==Automated==
==Workspace==
Here's the script's code:
003 | local ds = game:GetService( "DataStoreService" ):GetDataStore( "Stage" ) |
004 | local Players = game:GetService( "Players" ) |
005 | Players.CharacterAutoLoads = false |
010 | Player.CharacterAdded:connect( function (Character) |
017 | leaderstats.Name = "leaderstats" |
019 | local stage = Instance.new( "IntValue" , leaderstats) |
021 | stage.Value = ds:GetAsync(Player.Name) or 1 |
023 | local tim = Instance.new( "IntValue" , leaderstats) |
038 | Humanoid.Died:connect( function () |
040 | Player:LoadCharacter() |
042 | if Player.leaderstats.Stage.Value = = 1 then |
043 | Humanoid.Parent:MoveTo(workspace.Obstacles.Checkpoints [ "1" ] .Position) |
044 | elseif Player.leaderstats.Stage.Value = = 2 then |
045 | Humanoid.Parent:MoveTo(workspace.Obstacles.Checkpoints [ "2" ] .Position) |
046 | elseif Player.leaderstats.Stage.Value = = 3 then |
047 | Humanoid.Parent:MoveTo(workspace.Obstacles.Checkpoints [ "3" ] .Position) |
048 | elseif Player.leaderstats.Stage.Value = = 4 then |
049 | Humanoid.Parent:MoveTo(workspace.Obstacles.Checkpoints [ "4" ] .Position) |
050 | elseif Player.leaderstats.Stage.Value = = 5 then |
051 | Humanoid.Parent:MoveTo(workspace.Obstacles.Checkpoints [ "5" ] .Position) |
052 | elseif Player.leaderstats.Stage.Value = = 6 then |
053 | Humanoid.Parent:MoveTo(workspace.Obstacles.Checkpoints [ "6" ] .Position) |
054 | elseif Player.leaderstats.Stage.Value = = 7 then |
055 | Humanoid.Parent:MoveTo(workspace.Obstacles.Checkpoints [ "7" ] .Position) |
056 | elseif Player.leaderstats.Stage.Value = = 8 then |
057 | Humanoid.Parent:MoveTo(workspace.Obstacles.Checkpoints [ "8" ] .Position) |
058 | elseif Player.leaderstats.Stage.Value = = 9 then |
059 | Humanoid.Parent:MoveTo(workspace.Obstacles.Checkpoints [ "9" ] .Position) |
060 | elseif Player.leaderstats.Stage.Value = = 10 then |
061 | Humanoid.Parent:MoveTo(workspace.Obstacles.Checkpoints [ "10" ] .Position) |
062 | elseif Player.leaderstats.Stage.Value = = 11 then |
063 | Humanoid.Parent:MoveTo(workspace.Obstacles.Checkpoints [ "11" ] .Position) |
064 | elseif Player.leaderstats.Stage.Value = = 12 then |
065 | Humanoid.Parent:MoveTo(workspace.Obstacles.Checkpoints [ "12" ] .Position) |
066 | elseif Player.leaderstats.Stage.Value = = 13 then |
067 | Humanoid.Parent:MoveTo(workspace.Obstacles.Checkpoints [ "13" ] .Position) |
068 | elseif Player.leaderstats.Stage.Value = = 14 then |
069 | Humanoid.Parent:MoveTo(workspace.Obstacles.Checkpoints [ "14" ] .Position) |
070 | elseif Player.leaderstats.Stage.Value = = 15 then |
071 | Humanoid.Parent:MoveTo(workspace.Obstacles.Checkpoints [ "15" ] .Position) |
072 | elseif Player.leaderstats.Stage.Value = = 16 then |
073 | Humanoid.Parent:MoveTo(workspace.Obstacles.Checkpoints [ "16" ] .Position) |
074 | elseif Player.leaderstats.Stage.Value = = 17 then |
075 | Humanoid.Parent:MoveTo(workspace.Obstacles.Checkpoints [ "17" ] .Position) |
076 | elseif Player.leaderstats.Stage.Value = = 18 then |
077 | Humanoid.Parent:MoveTo(workspace.Obstacles.Checkpoints [ "18" ] .Position) |
078 | elseif Player.leaderstats.Stage.Value = = 19 then |
079 | Humanoid.Parent:MoveTo(workspace.Obstacles.Checkpoints [ "19" ] .Position) |
080 | elseif Player.leaderstats.Stage.Value = = 20 then |
081 | Humanoid.Parent:MoveTo(workspace.Obstacles.Checkpoints [ "20" ] .Position) |
088 | Player:LoadCharacter() |
094 | ds:UpdateAsync(Player.Name, function (oldValue) return Player.leaderstats.Stage.Value end ) |
097 | game.OnClose = function () |
098 | for i,v in pairs (Players:GetChildren()) do |
099 | ds:UpdateAsync(v.Name, function (oldValue) return v.leaderstats.Stage.Value end ) |
I think the problem is on line 23 to 25. When I test the game(I know the DataStore won't work), I get the Stage(IntValue) in my leaderstats. Now instead of seeing Time, I see Value(IntValue) on the next one.
Pls help me, I'm an intermediate scripter that needs help!!!