Why my game panel is adding more coins then normal?
Asked by
4 years ago Edited 4 years ago
Hello once more, i am trying to do a race game,but when the players win,the first race it all goes okay,but in next,the player gets added more coins then normal?
Here is the script (Server-sided):
01 | local ChangeText = game.ReplicatedStorage.GameTextShare |
03 | local Maps = game.ReplicatedStorage.Maps:GetChildren() |
05 | if #game.Players:GetPlayers() = = 1 then |
06 | ChangeText:FireAllClients(Space, "Not enough players! At least 2 players needed." ) |
10 | ChangeText:FireAllClients(Space, "Intermission: " .. tostring (i)) |
13 | ChangeText:FireAllClients(Space, "Selecting random map..." ) |
15 | local SelectedMap = Maps [ math.random( 1 , #Maps) ] :Clone() |
16 | SelectedMap.Parent = game.Workspace |
17 | ChangeText:FireAllClients(Space, "Map Selected: " ..SelectedMap.Name) |
19 | ChangeText:FireAllClients(Space, "Teleporting Players..." ) |
21 | ChangeText:FireAllClients(Space, "Get Ready!" ) |
24 | ChangeText:FireAllClients(Space, tostring (i)) |
27 | ChangeText:FireAllClients(Space, "Go!" ) |
30 | ChangeText:FireAllClients(Space, "Time Left: " .. tostring (i)) |
33 | ChangeText:FireAllClients(Space, "Times up!" ) |
34 | local Winners = require(game.ServerScriptService.PlaceOfPlayers) |
36 | game.Players [ Winners [ 1 ] ] .leaderstats.Coins.Value + = 250 |
37 | elseif #Winners = = 2 then |
38 | game.Players [ Winners [ 1 ] ] .leaderstats.Coins.Value + = 250 |
39 | game.Players [ Winners [ 2 ] ] .leaderstats.Coins.Value + = 150 |
40 | elseif #Winners > = 3 then |
41 | game.Players [ Winners [ 1 ] ] .leaderstats.Coins.Value + = 200 |
42 | game.Players [ Winners [ 2 ] ] .leaderstats.Coins.Value + = 100 |
43 | game.Players [ Winners [ 3 ] ] .leaderstats.Coins.Value + = 50 |
44 | for i,v in pairs (Winners) do |
45 | game.Players [ v ] .leaderstats.Coins.Value + = 50 |
48 | game.ReplicatedStorage.DeleteList:FireAllClients() |
49 | for i,v in ipairs (Winners) do |
53 | game.Workspace.PlaceGet.Value = 1 |
56 | for i,v in pairs (game.Players:GetPlayers()) do |
57 | v.Character.InWinner.Value = false |
58 | v.Character.InPlace.Value = 0 |
If you need more information ask
If it is a math problem sorry, i am not so good at it.
Thanks.