My minigame script is breaking?
I used this script for my minigames -
001 | AutomaticTimer = false |
009 | hint = Instance.new( 'Hint' ,Workspace) |
015 | hint.Text = "Intermission (" ..value.. ")" |
019 | hint.Text = "A minigame will be selected..." |
021 | m = game.Lighting.Minigames:GetChildren() |
024 | hint.Text = "The minigame is '" ..minigame.Name.. "'!" |
025 | map = minigame:clone() |
026 | map.Parent = Workspace |
028 | hint.Text = map.Description.Value |
029 | plrs = game.Players:GetChildren() |
031 | if plrs [ i ] .PlayerGui.PlayGui.Button.Playing.Value = = true then |
032 | plrs [ i ] .Character:MoveTo(map.Spawn.Position) |
035 | if map.GameType.Value = = "Race" or map.GameType.Value = = "Obby" then |
038 | hint.Text = "The round will begin in " ..value.. "" |
042 | for i = 0.05 , 1 , 0.05 do |
043 | map.Wall.Transparency = i |
046 | map.Wall.CanCollide = false |
047 | WinnerFinished = false |
048 | map.Finish.Touched:connect( function (hit) |
049 | if hit.Parent:findFirstChild( "Humanoid" ) ~ = nil then |
050 | local plr = game.Players:findFirstChild(hit.Parent.Name) |
051 | local cash = plr.leaderstats:findFirstChild(CashValue) |
052 | if not WinnerFinished then |
053 | cash.Value = cash.Value+WinnerCash |
054 | WinnerName = plr.Name |
055 | WinnerFinished = true |
056 | else cash.Value = cash.Value+FinishCash |
058 | hit.Parent:MoveTo(Workspace.GameSpawn.Position) |
059 | local t = hit.Parent:findFirstChild( 'Survived' ) |
063 | local h = hit.Parent:findFirstChild( 'SurvivalCheck' ) |
070 | plrs = game.Players:GetChildren() |
072 | if plrs [ i ] .PlayerGui.PlayGui.Button.Playing.Value = = true then |
073 | v = Instance.new( 'BoolValue' ) |
074 | v.Parent = plrs [ i ] .Character |
077 | s = script.SurvivalCheck:clone() |
078 | s.Parent = plrs [ i ] .Character |
082 | if map.GameType.Value = = "Survival" or map.GameType.Value = = "Custom" then |
085 | hint.Text = "The round will begin in " ..value.. "" |
089 | plrs = game.Players:GetChildren() |
091 | map.DisasterScript.Disabled = false |
094 | if not AutomaticTimer then |
095 | Time = minigame.Time.Value |
099 | hint.Text = "Time left: " ..value.. "" |
103 | hint.Text = "Round over!" |
104 | if map.GameType.Value = = "Race" or map.GameType.Value = = "Obby" then |
105 | if WinnerName ~ = nil then |
106 | hint.Text = "The winner was: " ..WinnerName.. "!" |
108 | hint.Text = "There was no winner this round!" |
110 | elseif map.GameType.Value = = "Survival" or map.GameType.Value = = "Custom" then |
111 | plrs = game.Players:GetChildren() |
113 | local s = plrs [ i ] .Character:findFirstChild( 'SurvivalCheck' ) |
117 | local t = plrs [ i ] .Character:findFirstChild( 'Survived' ) |
119 | if t.Value = = true then |
120 | plrs [ i ] .leaderstats.Points.Value = plrs [ i ] .leaderstats.Points.Value+SurvivorCash |
125 | if map.GameType = = "Custom" then |
126 | plrs [ i ] .Character:BreakJoints() |
131 | local t = plrs [ i ] .Character:findFirstChild( 'Survived' ) |
133 | if t.Value = = true then |
134 | plrs [ i ] .Character:MoveTo(Workspace.GameSpawn.Position or Workspace.GameSpawn 2. Position) |
I picked up an error on line 77 about SurvivalCheck.
The problem is, whenever it teleports players to the map, the whole script breaks.
In output, I get -
SurvivalCheck is not a valid member of Script
Here's the SurvivalCheck script -
1 | script.Parent.Humanoid.Died:connect( function () |
2 | script.Parent.Survived.Value = false |
Any help?