local tweenService = game:GetService "TweenService" local Step = function (self:…
- User
local tweenService = game:GetService "TweenService"
local Step = function (self: CircularObject) 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.ClassName ~= "Frame" then return end if i < goto then object.BackgroundColor3 = self.Colors.Fill continue end object.BackgroundColor3 = self.Colors.Empty endend
local Update = function (self: CircularObject) local tmpValue = Instance.new("NumberValue") tmpValue.Value = self.CurrentFill
tmpValue:GetPropertyChangedSignal('Value'):Connect(function(...) self.CurrentFill = tmpValue.Value Step(self) end) local tweenInfo = TweenInfo.new( .3, Enum.EasingStyle.Quart, Enum.EasingDirection.In ) local tween = tweenService:Create(tmpValue, tweenInfo, { Value = self.Fill }) tween:Play() tween.Completed:Wait() self.CurrentFill = self.Fillend
return Update
local module = function (self: CircularObject) if self.Range < 1 then return end;
local origin = self.Parent.Position + UDim2.new( 0, self.Parent.Size.X.Offset / 2, 0, self.Parent.Size.Y.Offset / 2 ) for i = 0, self.Range do local aplha = (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(aplha) * self.Space) + origin.X.Offset, 0, (math.sin(aplha) * self.Space) + origin.Y.Offset ) dot.ZIndex = -i local corner = Instance.new("UICorner", dot) corner.CornerRadius = UDim.new(1, 0) endend
return module
local FillModifiers = {}
local Update = require(script.Parent:FindFirstChild('Update'))
local Add = function (self: CircularObject, percentage: number) percentage = math.min(math.max(percentage, 0), 100) self.Fill += percentage self.Fill = math.min(self.Fill, 100) Update(self) end
local Set = function (self: CircularObject, percentage: number) percentage = math.min(math.max(percentage, 0), 100) self.Fill = percentage Update(self) end
FillModifiers.Add = Add FillModifiers.Set = Set
return FillModifiers
полностью измении эти скрипты напиши все сначала сделй так чтбы был один скрипт на созданеи ui ипо Module.NewProcessCircle( parent: Instance, size: number?, space: number?, range: number?)
local self = { Parent = parent, Size = size or 10, Space = space or 50, Range = range or 75, Fill = 0, CurrentFill = 0, Colors = { Fill = Color3.new(.2, .8, .2), Empty = Color3.new(1, 1, 1) }, Visible = true }только вместо parent будет тоже GUI
- Assistant
- User
добавь export type чтобы оно зря без типизации не ставилась
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) -- Parent frame for all dots }типо сделпй
export type CircularObject = { Parent: Instance, Object: Folder,
Size: number, Range: number, Space: number, Fill: number, CurrentFill: number, EndFlag: number?, CurrentFlag: number, Visible: boolean, Colors: CircularColor, Set: (self: CircularObject, percentage: number) -> any, Add: (self: CircularObject, percentage: number) -> any, SetColor: (self: CircularObject, colors: CircularColor) -> any,}
- Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.