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

Problem with Line 6?!

Hi there! I made a Teleport GUI. And everything I made was perfect but ever since I put the ScreenGui to ReplicatedStorage because I only want it to myself. Anyway I'm having trouble in Line 6 of this Script:

spawn = game.Workspace.HouseArea
player = script.Parent.Parent.Parent.Parent

local funtcion onClicked()
    local spawnArea = game.Workspace.HouseArea;
    local playerList = game.Players:GetChildren; --It keeps saying function arguments expected near ":"
    local playerToTeleport = nil;

    for key, value in pairs(playerList) do
        playerToTeleport = game.Workspace:FindFirstChild(value.Name);
        if playerToTeleport ~= nill then
            player.Torso.CFrame = CFrame.new(spawnArea.Position);
        end
    end
end

script.Parent.MouseButton1Down:connect(onClicked)

Please Help

1 answer

GetChildren is a method, meaning you have to call it -- it will have parenthesis immediately after it.

local playerList = game.Players:GetChildren()

Parenthesis enclose the function's arguments which is what that error was requesting you provide.


You are recommended to use :GetPlayers() instead of :GetChildren() since it is more semantically meaningful.

1 comment

0

Sir now i have problem in Line 15

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