My game has a big bag that i can't fix? [closed]
Asked by
4 years ago Edited 4 years ago
I am making a minigames game and every time i die when it select the next minigame it will just say that i won the game but i didn't (in the sword fights level need to be 2 players)
if i don't reply i am not home,
Here is the link for my game if you want to try it yourself: --https://web.roblox.com/games/5634823302/Minigames
here is my main script:
001 | if game.Workspace:FindFirstChild( "Baseplate" ) then |
002 | game.Workspace.Baseplate:Destroy() |
005 | local Seconds = game.ReplicatedStorage.Seconds |
006 | local Minutes = game.ReplicatedStorage.Minutes |
007 | local TimerValue = game.ReplicatedStorage.TimerText |
008 | local IsIntermision = false |
011 | function Counter(minutes, seconds) |
012 | Minutes.Value = minutes |
013 | Seconds.Value = seconds |
016 | if game.ReplicatedStorage.EndMinigame.Value = = true then |
019 | TimerValue.Value = "00:00" |
020 | game.ReplicatedStorage.EndMinigame.Value = false |
023 | if Seconds.Value > 0 then |
024 | Seconds.Value = Seconds.Value - 1 |
025 | elseif Seconds.Value = = 0 and Minutes.Value > 0 then |
027 | Minutes.Value = Minutes.Value - 1 |
028 | elseif Seconds.Value = = 0 and Minutes.Value = = 0 then |
031 | if IsIntermision = = true then |
032 | if Minutes.Value < = 9 and Seconds.Value < = 9 then |
033 | TimerValue.Value = "Intermision 0" ..Minutes.Value.. ":0" ..Seconds.Value |
034 | elseif Minutes.Value < 10 then |
035 | TimerValue.Value = "Intermision 0" ..Minutes.Value.. ":" ..Seconds.Value |
036 | elseif Seconds.Value < 10 then |
037 | TimerValue.Value = "Intermision " ..Minutes.Value.. ":0" ..Seconds.Value |
039 | elseif IsIntermision = = false then |
040 | if Minutes.Value < = 9 and Seconds.Value < = 9 then |
041 | TimerValue.Value = "0" ..Minutes.Value.. ":0" ..Seconds.Value |
042 | elseif Minutes.Value < 10 then |
043 | TimerValue.Value = "0" ..Minutes.Value.. ":" ..Seconds.Value |
044 | elseif Seconds.Value < 10 then |
045 | TimerValue.Value = Minutes.Value.. ":0" ..Seconds.Value |
046 | if game.ReplicatedStorage.EndMinigame.Value = = true then |
049 | TimerValue.Value = "00:00" |
050 | game.ReplicatedStorage.EndMinigame.Value = false |
059 | function TeleportPlayers(Position) |
060 | for i,v in pairs (game.Players:GetPlayers()) do |
061 | v.Character.HumanoidRootPart.CFrame = Position |
065 | function SelectMinigame() |
066 | local Maps = game.ServerStorage.Maps |
067 | local RandomMapIndex = math.random( 1 ,#Maps:GetChildren()) |
068 | local ClonedMap = Maps:GetChildren() [ RandomMapIndex ] :Clone() |
069 | ClonedMap.Name = "Map" |
070 | ClonedMap.Parent = workspace |
071 | local Message = Instance.new( "Message" ) |
072 | Message.Parent = workspace |
073 | local Text = "Choosed Minigame: " ..Maps:GetChildren() [ RandomMapIndex ] .Name |
075 | Message.Text = string.sub(Text, 1 ,i) |
079 | local Text 2 = ClonedMap.Description.Value |
080 | for i = 1 ,#Text 2 , 1 do |
081 | Message.Text = string.sub(Text 2 , 1 ,i) |
086 | local RandomSpawnIndex = math.random( 1 ,#ClonedMap.Spawns:GetChildren()) |
087 | local RandomSpawn = ClonedMap.Spawns:GetChildren() [ RandomMapIndex ] |
088 | for i,player in pairs (game.Players:GetChildren()) do |
089 | if ClonedMap:FindFirstChild( "Swords" ) then |
090 | local RandomToolIndex = math.random( 1 ,#ClonedMap.Swords:GetChildren()) |
091 | local RandomTool = ClonedMap.Swords:GetChildren() [ RandomToolIndex ] |
092 | local ClonedTool = RandomTool:Clone() |
093 | ClonedTool.Parent = player.Character |
094 | ClonedTool.Name = "Tool" |
096 | player.Character.HumanoidRootPart.CFrame = RandomSpawn.CFrame |
097 | player.Dead.Value = false |
099 | player.Dead.Value = false |
101 | Counter(ClonedMap.Minutes.Value,ClonedMap.Seconds.Value) |
102 | print ( "Minigame Ended" ) |
104 | for index, player in pairs (game.Players:GetChildren()) do |
105 | if player.Dead.Value = = false then |
106 | player.leaderstats.Wins.Value = player.leaderstats.Wins.Value+ 1 |
107 | player.Points.Value = player.Points.Value+ 10 |
108 | table.insert(winers,#winers+ 1 , tostring (player.Name)) |
111 | local M 2 = Instance.new( "Message" ) |
112 | M 2. Parent = workspace |
113 | local WinersTable = table. unpack (winers, 1 ,#winers) |
116 | T 3 = "Winers:" ..WinersTable |
118 | T 3 = "No one has survived" |
121 | M 2. Text = string.sub(T 3 , 1 ,i) |
124 | for i,v in pairs (game.Players:GetChildren()) do |
125 | if v.Character:FindFirstChild( "Tool" ) then |
126 | v.Character.Tool:Destroy() |
130 | for i = 1 ,#winers, 1 do |
131 | table.remove(winers,i) |
133 | TeleportPlayers(game.Workspace.SpawningRoom.SpawnLocation.CFrame) |
137 | if TimerValue.Value = = "00:00" then |
138 | if IsIntermision = = false then |
140 | print ( "IsNotIntermission" ) |
141 | elseif IsIntermision = = true then |
142 | if game.Workspace:FindFirstChild( "Map" ) then |
143 | game.Workspace.Map:Destroy() |
147 | game.ReplicatedStorage.EndMinigame.Value = false |
149 | IsIntermision = false |