Im working on a role system where a player opens a gui and can choose a role. Sadly, the code isnt working.
local PBtool = game.ServerStorage.RoleplayTools.Potion
local roleList = game.StarterGui.ScreenGui.RoleList.ScrollingFrame.Roles
local Buttons = {
roleList:FindFirstChild("Janitor"),
roleList:FindFirstChild("Enforcer"),
roleList:FindFirstChild("Assassin"),
roleList:FindFirstChild("Guardian Angel"),
roleList:FindFirstChild("Executioner"),
roleList:FindFirstChild("Puppeteer"),
roleList:FindFirstChild("Medusa"),
roleList:FindFirstChild("Godfather"),
roleList:FindFirstChild("Outlaw"),
roleList:FindFirstChild("Magician"),
roleList:FindFirstChild("Toxicologist"),
roleList:FindFirstChild("Veteran"),
roleList:FindFirstChild("Investigator"),
roleList:FindFirstChild("Liberator"),
roleList:FindFirstChild("Disrupter"),
roleList:FindFirstChild("Townie"),
roleList:FindFirstChild("Sheriff"),
roleList:FindFirstChild("Executive")
}
for i, v in pairs(Buttons) do
v.MouseButton1Click:Connect(function(player)
local char = player.Character
local head = char:WaitForChild("Head")
if v == "Townie" then
local Tgui = game.ServerStorage["RoleGui's"]:FindFirstChild("TownieGui")
Tgui.Parent = head
end
end)
end