local TweenService = game:GetService("TweenService") local Module = {} function…
- User
local TweenService = game:GetService("TweenService")
local Module = {}
function Module.NewProcessCircle(gui: Instance, size: number?, space: number?, range: number?)
local self = { Parent = gui, Size = size or 10, Space = space or 50, Range = range or 75, Fill = 0, CurrentFill = 0, Colors = { Fill = Color3.new(0.2, 0.8, 0.2), Empty = Color3.new(1, 1, 1) }, Visible = true, Object = Instance.new("Frame", gui) } self.Object.Size = UDim2.new(0, self.Size * 2, 0, self.Size * 2) self.Object.BackgroundTransparency = 1 self.Object.Position = UDim2.new(0.5, -self.Object.Size.X.Offset / 2, 0.5, -self.Object.Size.Y.Offset / 2) local function Step() local percent = self.CurrentFill / 100 local goto = math.floor(percent * self.Range) for i = 0, self.Range do local object = self.Object:FindFirstChild(tostring(i)) if not object then continue end if object:IsA("Frame") then if i < goto then object.BackgroundColor3 = self.Colors.Fill else object.BackgroundColor3 = self.Colors.Empty end end end end local function Update() local tmpValue = Instance.new("NumberValue") tmpValue.Value = self.CurrentFill tmpValue:GetPropertyChangedSignal("Value"):Connect(function() self.CurrentFill = tmpValue.Value Step() end) local tweenInfo = TweenInfo.new(0.3, Enum.EasingStyle.Quart, Enum.EasingDirection.In) local tween = TweenService:Create(tmpValue, tweenInfo, { Value = self.Fill }) tween:Play() tween.Completed:Wait() self.CurrentFill = self.Fill end local function Add(percentage) percentage = math.min(math.max(percentage, 0), 100) self.Fill = math.min(self.Fill + percentage, 100) Update() end local function Set(percentage) percentage = math.min(math.max(percentage, 0), 100) self.Fill = percentage Update() end local function SetColors(colors) if colors.Fill then self.Colors.Fill = colors.Fill end if colors.Empty then self.Colors.Empty = colors.Empty end Step() end for i = 0, self.Range do local alpha = (i / self.Range) * math.pi * 2 local dot = Instance.new("Frame", self.Object) dot.Name = tostring(i) dot.Size = UDim2.new(0, self.Size, 0, self.Size) dot.Position = UDim2.new( 0, (math.cos(alpha) * self.Space) + self.Object.Size.X.Offset / 2, 0, (math.sin(alpha) * self.Space) + self.Object.Size.Y.Offset / 2 ) dot.ZIndex = -i local corner = Instance.new("UICorner", dot) corner.CornerRadius = UDim.new(1, 0) end self.Add = Add self.Set = Set self.SetColors = SetColors return selfend
return Module
local e = require(game:GetService("ReplicatedStorage"):WaitForChild("ModuleScript"))
local aw = e.NewProcessCircle(script.Parent, 15, 50, 75)
aw:SetColors({ Fill = Color3.fromRGB(255, 0, 0), Empty = Color3.fromRGB(0, 0, 0) })
aw.Set(65)
task.wait(4)
aw.Add(10)
15:38:32.217 Unable to assign property BackgroundColor3. Color3 expected, got number - Client - ModuleScript:36 15:38:32.217 Stack Begin - Studio 15:38:32.217 Script 'ReplicatedStorage.ModuleScript', Line 36 - function Step - Studio - ModuleScript:36 15:38:32.217 Script 'ReplicatedStorage.ModuleScript', Line 50 - Studio - ModuleScript:50 15:38:32.217 Stack End - Studio
- Assistant
- User
нет они все должнгы стоять за end функии NewProcessCircle
- Assistant
- User
ало все функции должены быть снаружи функции NewProcessCircle а не внутри
- Assistant