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
local replicatedStorage = game:GetService("ReplicatedStorage") local serverStorage = game:GetService("ServerStorage") local status = replicatedStorage.Values.Status local playersToStart = 1 local function chooseSeeker(availablePlayers) return availablePlayers[math.random(1, #availablePlayers)] end local function teleportPlayers(availablePlayers,spawns) for _, player in pairs(availablePlayers) do if player.Character then if player.Character:FindFirstChild("HumanoidRootPart") then player.Character.HumanoidRootPart.CFrame = spawns[math.random(1, #spawns)].CFrame + Vector3.new(0,5,0) end end end end while wait(1) do repeat print("Not enough players in game!") status.Value = playersToStart.." players needed to start (/"..playersToStart..")" wait(1) until #game.Players:GetPlayers() >= playersToStart for i = 5,0,-1 do status.Value = "Next round starts in "..i.." seconds" wait(0.1) end local contestants = game.Players:GetPlayers() local seeker = chooseSeeker(contestants) status.Value = "The chosen seeker is... " wait(1) status.Value = seeker.Name.."!" wait(3) local map = game.Workspace.Map1 teleportPlayers(contestants,map.Spawns:GetChildren()) wait(5) end
Client Main
local replicatedStorage = game:GetService("ReplicatedStorage") local serverStorage = game:GetService("ServerStorage") local status = replicatedStorage.Values.Status local timer = replicatedStorage.Values.Timer local playersLeft = replicatedStorage.Values.PlayersLeft local HUD = script.Parent local statusFrame = HUD:WaitForChild("Status") local playersLeftFrame = HUD:WaitForChild("PlayersLeft") statusFrame.StatusTitle.Text = status.Value status:GetPropertyChangedSignal("Value"):Connect(function() statusFrame.StatusTitle.Text = status.Value statusFrame.TimeLeft.Text = timer.Value playersLeftFrame.PlayersLeft.Text = playersLeft.Value end) timer:GetPropertyChangedSignal("Value"):Connect(function() statusFrame.TimeLeft.Text = timer.Value end) playersLeft:GetPropertyChangedSignal("Value"):Connect(function() playersLeftFrame.PlayersLeft.Text = playersLeft.Value end)
Fxicity
hello, try this
player.Character.HumanoidRootPart.CFrame = spawns[Random.new():NextInteger(1, #spawns)].CFrame + Vector3.new(0,5,0) -- line 16