I have a script that teleports players at the start of a game and has messages that show up on a TextLabel. For some reason it is not working, so I looked at the warnings and error messages. The error message says "RemoteEvent is not a valid member of ReplicatedStorage", and there are warnings that say "Unknown global 'player'". There are blue underlines under where it says player in the remote.FireClient spot. I appreciate any help. Thanks!
EDIT: I have fixed the "RemoteEvent is not a valid member of ReplicatedStorage" error and the "Unknown global 'player'" warnings, but now it says "FireClient: player argument must be a Player object". I don't know why it says this as I believe am using a Player object, as shown below in my code. Thanks for helping, and sorry for the beginner questions.
Script code:
local oldMessage = ""
local minPlayers = 1
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local messagePlayerEvent = Instance.new("RemoteEvent")
messagePlayerEvent.Parent = game.ReplicatedStorage
messagePlayerEvent.Name = "MessagePlayerEvent"
function teleportPlayers()
local TeleportTarget = ""
local target = CFrame.new(workspace.StartP1.Position)
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
player.Playing.Value = 1
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
local text = "Waiting for an available arena..."
messagePlayerEvent:FireClient(player, text)
else
local text = "There are enough players for a new game! Teleporting..."
messagePlayerEvent:FireClient(player, text)
wait(4)
teleportPlayers()
end
else
local text = "Waiting for more players..."
messagePlayerEvent:FireClient(player, text)
end
end
LocalScript code:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local messagePlayerEvent = ReplicatedStorage:WaitForChild("MessagePlayerEvent")
messagePlayerEvent.OnClientEvent:Connect(function(text)
script.Parent.Text = text
end)

6 comments
Is there a remote event named RemoteEvent in replicated storage?
I don't know so I am reading about remote events.
Ok so you defined the player as localPlayer so this has to be a local script, but you're using FireClient, which is meant to be sent from the server to a client. You need to use FireServer if this is a local script.
On a server script you cant use LocalPlayer. Thats why the player argument isnt working.
What would I use instead?
Never mind I am asking a new question