null nil true RBXStatusBuffsGUIScript local vChar = script.Parent local vPlayer = game.Players:GetPlayerFromCharacter(vChar) playerGui = vPlayer.PlayerGui local config = vChar:FindFirstChild("PlayerStats") while config == nil do config = vChar:FindFirstChild("PlayerStats") wait(1) end buffGui = Instance.new("ScreenGui") buffGui.Parent = playerGui buffGui.Name = "BuffGUI" tray = Instance.new("Frame") tray.BackgroundTransparency = 1.0 tray.Parent = buffGui tray.Name = "Tray" tray.Position = UDim2.new(0.40, 0.0, 0.95, 0.0) tray.Size = UDim2.new(0.0, 300.0, 0.0, 30.0) tray.BorderColor3 = Color3.new(0, 0, 0) tray.Visible = true local iceLabel = Instance.new("ImageLabel") iceLabel.Name = "Ice" iceLabel.Size = UDim2.new(0.1, 0.0, 0.8, 0.0) --iceLabel.Position = UDim2.new(0.25, 0.0, 0.0, 0.0) iceLabel.BackgroundTransparency = 1.0 iceLabel.Image = "http://www.roblox.com/asset/?id=47522829" iceLabel.Visible = true -- iceLabel.Parent = tray local poisonLabel = Instance.new("ImageLabel") poisonLabel.Name = "Poison" poisonLabel.Size = UDim2.new(0.1, 0.0, 0.8, 0.0) --poisonLabel.Position = UDim2.new(0.50, 0.0, 0.0, 0.0) poisonLabel.BackgroundTransparency = 1.0 poisonLabel.Image = "http://www.roblox.com/asset/?id=47525343" poisonLabel.Visible = true local fireLabel = Instance.new("ImageLabel") fireLabel.Name = "Fire" fireLabel.Size = UDim2.new(0.1, 0.0, 0.8, 0.0) fireLabel.BackgroundTransparency = 1.0 fireLabel.Image = "http://www.roblox.com/asset/?id=47522853" fireLabel.Visible = true local stunLabel = Instance.new("ImageLabel") stunLabel.Name = "Stun" stunLabel.Size = UDim2.new(0.1, 0.0, 0.8, 0.0) stunLabel.BackgroundTransparency = 1.0 stunLabel.Image = "http://www.roblox.com/asset/?id= 47522868" stunLabel.Visible = true -- The table that contains the list of all the status buff images local labels = {poisonLabel, iceLabel, fireLabel, stunLabel} -- Contains the list of active Labels to draw them local activeLabels = {} -- Copies the necessary labels local buffsGuiTable = { ["Speed"] = function () end, ["MaxHealth"] = function () end, ["Poison"] = function () table.insert(activeLabels, labels[1]) end, ["Ice"] = function() table.insert(activeLabels, labels[2]) end, ["Fire"] = function() table.insert(activeLabels, labels[3]) end, ["Stun"] = function() table.insert(activeLabels, labels[4]) end } function statusBuffGui() activeLabels = {} for a = 1, #labels do labels[a].Active = false labels[a].Visible = false end activeBuffs = config:GetChildren() -- removeFromTray = tray:GetChildren() print(#buffsGuiTable) print(#activeBuffs) if #activeBuffs > 2 then for i = 1, #activeBuffs do print(activeBuffs[i].Name) buffsGuiTable[activeBuffs[i].Name]() end -- Retractable buffs GUI, displaced from the center --[[ if #activeLabels > 0 then for j = 1, #activeLabels do count = 1 norm = j - 1 median = 0 if #activeLabels%2 == 0 then median = -0.06 end if norm == 0 then activeLabels[j].Position = UDim2.new(0.45 + median, 0.0, 0.0, 0.0) elseif norm > 0 and norm%2 == 0 then activeLabels[j].Position = UDim2.new(((norm -(count * 3.0)) * 0.1) + 0.45 + median, 0.0, 0.0, 0.0) count = count + 1 else activeLabels[j].Position = UDim2.new((norm * 0.1) + 0.45 + median, 0.0, 0.0, 0.0) end activeLabels[j].Parent = tray activeLabels[j].Active = true end end ]]-- print(#activeLabels) if #activeLabels > 0 then count = 0 parity = 1 median = 0.45 if #activeLabels%2 == 0 then median = .5 end for j = 1, #activeLabels do activeLabels[j].Position = UDim2.new(median + parity*count, 0.0, 0.0, 0.0) if j%2 == 1 then count = count + .1 end parity = parity * -1 activeLabels[j].Parent = tray activeLabels.Active = true end end end end -- Blinking Labels function blinkGui() while true do for n = 1, #activeLabels do activeLabels[n].Visible = not activeLabels[n].Visible end wait(0.5) end end blink = coroutine.create(blinkGui) coroutine.resume(blink) -- Event Listeners config.ChildAdded:connect(statusBuffGui) config.ChildRemoved:connect(statusBuffGui) true