I am trying to make text appear depending on different scenarios, but I can't get the text to change. I looked this problem up and found that it only works in local scripts, but I cannot make this script local because it is in ServerScriptService. How can I get this to work if it can't be a local script?
Link to explorer image: https://drive.google.com/file/d/1igwetXrLgoLHzFoOCEv3BScwobnpO8O8/view?usp=sharing
Here is the code:
local oldMessage = ""
local minPlayers = 1
local Label = game.StarterGui.ScreenGui.GameMessageLabel
function teleportPlayers()
local TeleportTarget = ""
local target = CFrame.new(workspace.StartP1.Position)
print("trying to teleport players")
for i, player in ipairs(game.Players:GetChildren()) do
TeleportTarget = (string.format("StartP%s", i))
target = CFrame.new(workspace[TeleportTarget].Position)
player.Character.HumanoidRootPart.CFrame = target + Vector3.new(0, i * 5, 0)
player.Playing.Value = 1
--add an offset of 5 for each character
end
end
function message(message)
if oldMessage ~= message then
oldMessage = message
print(message)
end
end
function playersCurrentlyPlaying()
for i, player in ipairs(game.Players:GetChildren()) do
if player.Playing.Value == 1 then return true end
end
return false
end
game:GetService('Players').PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
character:WaitForChild("Humanoid").Died:Connect(function()
player.Playing.Value = 0
end)
end)
local playing = Instance.new("IntValue", player)
playing.Value = 0
playing.Name = "Playing"
end)
while(true) do
wait(10)
if #game.Players:getPlayers() >= minPlayers then
if playersCurrentlyPlaying() then
Label.Text = "Waiting for an available arena..."
else
Label.Text = "There are enough players for a new game! Teleporting..."
wait(3)
Label.Text = "Does this work?"
wait(4)
teleportPlayers()
end
else
Label.Text = "Waiting for more players..."
end
end

2 comments
Have you tried RemoteEvents? You can use that
^