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

help defining player in module script?

Asked by
waifuSZN 123
7 years ago
local Roles = {}
local Players = game.Players:GetService("Players")
local PlayersService = game.Players

--Mafia Functions
Roles.Mafia = {}
function Roles.Mafia.Target(Player)
    local gui = Instance.new('ScreenGui')
    gui.Name = 'PlayerList'
    gui.Parent = Players.LocalPlayer:WaitForChild('PlayerGui')  

    local frm = Instance.new('ScrollingFrame')
    frm.Name = 'Content'
    frm.Size = UDim2.new(0, 200, 0, 400)
    frm.Position = UDim2.new(0.5, -180, 0.5, 170)
    frm.BackgroundColor3 = BrickColor.Black().Color
    frm.BackgroundTransparency = .7
    frm.Parent = gui

    local function mkLbl()
        local tmp = Instance.new('TextLabel')
        tmp.Size = UDim2.new(1,0, 0, 25)
        tmp.Font = Enum.Font.ArialBold
        tmp.FontSize = Enum.FontSize.Size18
        return tmp
    end

    local y = 0

    for i,v in pairs(game.Players:GetChildren()) do
        local tmp = mkLbl()
            tmp.Position = UDim2.new(0,0,0, y)
            y = y + 25 -- 25 size
            tmp.Text = Players.Name
            tmp.Parent = frm
            tmp.MouseButton1Click:connect(function()
                Player.Character:Destroy()
            end)
    end


end

See question.

Am I defining player correctly? Anything else wrong with function?

0
Players is defined incorrectly. Just do game.Players. Or you can do game:GetService("Players") AstrealDev 728 — 7y

Answer this question