Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Unable to get "GetPlayers" from Players. Help?

Asked by
xp5u 25
3 years ago
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

Log in to vote
0
Answered by 3 years ago

you just got the capitalization wrong

it should be like this

local Players = game.Players:GetPlayers()
Ad

Answer this question