Bad Argument (Interval Is Empty)?
Asked by
4 years ago Edited 4 years ago
The code is for a hide n seek game and there is 2 scripts so far. Im having trouble with line 16.
Here is the code, please help me and thanks. And if you need the other script as well it is below this one.
Server Main
01 | local replicatedStorage = game:GetService( "ReplicatedStorage" ) |
02 | local serverStorage = game:GetService( "ServerStorage" ) |
04 | local status = replicatedStorage.Values.Status |
06 | local playersToStart = 1 |
08 | local function chooseSeeker(availablePlayers) |
09 | return availablePlayers [ math.random( 1 , #availablePlayers) ] |
12 | local function teleportPlayers(availablePlayers,spawns) |
13 | for _, player in pairs (availablePlayers) do |
14 | if player.Character then |
15 | if player.Character:FindFirstChild( "HumanoidRootPart" ) then |
16 | player.Character.HumanoidRootPart.CFrame = spawns [ math.random( 1 , #spawns) ] .CFrame + Vector 3. new( 0 , 5 , 0 ) |
26 | print ( "Not enough players in game!" ) |
27 | status.Value = playersToStart.. " players needed to start (/" ..playersToStart.. ")" |
31 | until #game.Players:GetPlayers() > = playersToStart |
34 | status.Value = "Next round starts in " ..i.. " seconds" |
39 | local contestants = game.Players:GetPlayers() |
41 | local seeker = chooseSeeker(contestants) |
43 | status.Value = "The chosen seeker is... " |
45 | status.Value = seeker.Name.. "!" |
49 | local map = game.Workspace.Map 1 |
51 | teleportPlayers(contestants,map.Spawns:GetChildren()) |
Client Main
01 | local replicatedStorage = game:GetService( "ReplicatedStorage" ) |
02 | local serverStorage = game:GetService( "ServerStorage" ) |
04 | local status = replicatedStorage.Values.Status |
06 | local timer = replicatedStorage.Values.Timer |
08 | local playersLeft = replicatedStorage.Values.PlayersLeft |
10 | local HUD = script.Parent |
11 | local statusFrame = HUD:WaitForChild( "Status" ) |
12 | local playersLeftFrame = HUD:WaitForChild( "PlayersLeft" ) |
14 | statusFrame.StatusTitle.Text = status.Value |
16 | status:GetPropertyChangedSignal( "Value" ):Connect( function () |
17 | statusFrame.StatusTitle.Text = status.Value |
18 | statusFrame.TimeLeft.Text = timer.Value |
19 | playersLeftFrame.PlayersLeft.Text = playersLeft.Value |
22 | timer:GetPropertyChangedSignal( "Value" ):Connect( function () |
23 | statusFrame.TimeLeft.Text = timer.Value |
26 | playersLeft:GetPropertyChangedSignal( "Value" ):Connect( function () |
27 | playersLeftFrame.PlayersLeft.Text = playersLeft.Value |
Fxicity