Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Unable to get "GetPlayers" from Players. Help?

local DialogueEvent = game.ReplicatedStorage.RemoteEvent:FindFirstChild("DialogueEvent")
local ObjectiveEvent = game.ReplicatedStorage.RemoteEvent:FindFirstChild("ObjectiveEvent")
local TransitionEvent = game.ReplicatedStorage.RemoteEvent:FindFirstChild("TransitionEvent")

local ToggleDialogueEvent = game.ReplicatedStorage.RemoteEvent:FindFirstChild("ToggleDialogueEvent")
local ToggleObjectiveEvent = game.ReplicatedStorage.RemoteEvent:FindFirstChild("ToggleObjectiveEvent")

local function Teleport(Position)
	local Players = game.Players:Getplayers()
	
	for i, player in pairs(Players) do
		if player.Character then
			player.Character.Humanoid.Jump = true
			player.Character:SetPrimaryPartCFrame(Position)
			
		end
	end
end

local function MainGame()
	ToggleDialogueEvent:FireAllClients(true)
	DialogueEvent:FireAllClients("I need to head down to the nearby sewer drain.")
	wait(4)
	ToggleDialogueEvent:FireAllClients(false)
	ToggleObjectiveEvent:FireAllClients(true)
	ObjectiveEvent:FireAllClients("Find the tunnel.")
	
	repeat wait() until game.Workspace.Triggers.DialogueTrigger:FindFirstChild("FoundOfficeTrigger") == nil
	
	ToggleDialogueEvent:FireAllClients(true)
	ToggleObjectiveEvent:FireAllClients(false)
	DialogueEvent:FireAllClients("You are here.")
	wait(4)
	ToggleDialogueEvent:FireAllClients(false)
	ToggleObjectiveEvent:FireAllClients(true)
	ObjectiveEvent:FireAllClients("Continue down the tunnel")
	
	repeat wait() until game.Workspace.Triggers.DialogueTrigger:FindFirstChild("FoundMainRoom") == nil
	
	ToggleDialogueEvent:FireAllClients(true)
	ToggleObjectiveEvent:FireAllClients(false)
	DialogueEvent:FireAllClients("You found the intersection.")
	wait(4)
	ToggleDialogueEvent:FireAllClients(false)
	ToggleObjectiveEvent:FireAllClients(true)
	ObjectiveEvent:FireAllClients("Find a key to continue.")
	
	repeat wait() until game.Workspace.Triggers.DialogueTrigger:FindFirstChild("FoundMazeRoom") == nil

	ToggleDialogueEvent:FireAllClients(true)
	ToggleObjectiveEvent:FireAllClients(false)
	DialogueEvent:FireAllClients("Woah, that was unexpected.")
	wait(4)
	ToggleDialogueEvent:FireAllClients(false)
	ToggleObjectiveEvent:FireAllClients(true)
	ObjectiveEvent:FireAllClients("Find the Crowbar to continue.")
	
	repeat wait() until game.Workspace.Triggers.DialogueTrigger:FindFirstChild("FoundGymRoom") == nil
	
	TransitionEvent:FireAllClients()
	wait(2)
	
	Teleport(game.Workspace.TeleportPoints.MazeTeleport.CFrame)
	
	
	
end

wait(10)
MainGame()

it is in ServerScriptService

1 answer

you just got the capitalization wrong

it should be like this

local Players = game.Players:GetPlayers()

This discussion is preserved as it was. New answers, comments, and votes are closed.