Local script:
local TeleportService = game:GetService("TeleportService") local plrs = game.ServerScriptService.Add.Players --numbervalue local place = 1011676824 local plr = game.Players.LocalPlayer text = script.Parent.Display if plrs.Value >= 5 then text.Text = "The game is about to start!" text.TextColor3 = Color3.new(255,0,0) wait(3) TeleportService:Teleport(place,plr) end
I have another script that adds to plrs.Value
once a player joins the game. My script waits until there are 5 players then teleports them to another game. The problem is that this script works fine in studio but doesn't work in game. The error that only shows up in game is "ServerScriptService is not a valid member of DataModel." I don't understand this error since I defined ServerScriptService through the game.
You cannot access ServerScriptStorage, from the client.
Seems you're attempting to teleport the client once there are five players in the server. You need to establish a loop in order to consistently check the amount of players.
plr
parameter when using the Teleport
function from the clientlocal TeleportService = game:GetService("TeleportService") local place = 1011676824 local text = script.Parent:WaitForChild("Display") --May not have loaded --Wait for minimum number of players --This is an example of a 'repeat' loop repeat wait() until #game.Players:GetPlayers() >= 5 text.Text = "The game is about to start!" text.TextColor3 = Color3.new(255,0,0) wait(3) TeleportService:Teleport(place)