Money giving script doesnt work. How can i solve it ? It is a sword game
Asked by
4 years ago Edited 4 years ago
I made a sword game and i made a function which is giving money to winner. But it doesnt work
01 | local mapstoragechild = game.Workspace.MapStorage:GetChildren() |
02 | local players = game.Players:GetPlayers() |
03 | local message = game.Workspace.Message |
04 | local rp = game.Workspace.MapStorage.Map.PlayerStorage:GetChildren() |
07 | rp [ i ] .Humanoid.Health = 0 |
10 | while #mapstoragechild = = 1 do |
11 | local playerleft = game.Workspace.MapStorage.Map.PlayerStorage:GetChildren() |
13 | local plp = playerleft:GetPlayerFromCharacter() |
14 | for i = 1 , #playerleft do |
15 | plp [ i ] .leaderstats.Money.Value = plp [ i ] .leaderstats.Money.Value + 10 |
18 | if #playerleft = = 1 then |
22 | game.Workspace.MapStorage:ClearAllChildren() |
23 | script.Parent.Gameselect.Disabled = true |
25 | script.Parent.Intermission.Disabled = false |
26 | game.Workspace.Gamemode.Value = 0 |
27 | message.Value = "Game Ended !" |
28 | game.Workspace.Songs.Songloop.Disabled = false |
30 | script.Parent.Gameselect.Disabled = false |
31 | script.Disabled = true |