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)
The error you said you got means the item wasn't there. It might have been a typo. If it wasn't there wasn't a instance named "RemoteEvent" in ReplicatedStorage. If this if this isn't help, I would like a screenshot of the ReplicatedStorage.