-- Compiled with roblox-ts v1.3.2 local TS = _G[script] local Hooks = TS.import(script, TS.getModule(script, "@rbxts", "roact-hooks").src) local Roact = TS.import(script, TS.getModule(script, "@rbxts", "roact").src) local useDispatch = TS.import(script, script.Parent.Parent, "hooks", "use-dispatch").default local _story_actions = TS.import(script, script.Parent, "story-actions") local DecrementValue = _story_actions.DecrementValue local IncrementValue = _story_actions.IncrementValue local SetValue = _story_actions.SetValue local GetNumberFromString = function(value) if value == nil or not (type(value) == "string") then return if value ~= nil and type(value) == "number" then value else 0 else local number = tonumber(value) if number ~= nil then return number else local match = (string.match(value, "%-?%d+%.?%d*")) local _result if match ~= nil then local _condition = tonumber(match) if _condition == nil then _condition = 0 end _result = _condition else _result = 0 end return _result end end end local Component = function(props, hooks) local dispatch = useDispatch(hooks) local currentText, setCurrentText = hooks.useBinding("") local onTextChange = hooks.useCallback(function(rbx) return setCurrentText(rbx.Text) end, {}) local onSetActivated = hooks.useCallback(function() dispatch(SetValue(GetNumberFromString(currentText:getValue()))) end, { dispatch }) local onDecrementActivated = hooks.useCallback(function() dispatch(DecrementValue()) end, { dispatch }) local onIncrementActivated = hooks.useCallback(function() dispatch(IncrementValue()) end, { dispatch }) return Roact.createElement("Frame", { AnchorPoint = props.AnchorPoint, AutomaticSize = Enum.AutomaticSize.XY, BackgroundTransparency = 1, LayoutOrder = props.LayoutOrder, Position = props.Position, Size = UDim2.new(), }, { UIListLayout = Roact.createElement("UIListLayout", { FillDirection = Enum.FillDirection.Horizontal, HorizontalAlignment = Enum.HorizontalAlignment.Center, Padding = UDim.new(0, 5), SortOrder = Enum.SortOrder.LayoutOrder, VerticalAlignment = Enum.VerticalAlignment.Center, }), ValueBox = Roact.createElement("TextBox", { BackgroundColor3 = Color3.fromRGB(37, 37, 37), BorderSizePixel = 0, [Roact.Change.Text] = onTextChange, Font = Enum.Font.Gotham, PlaceholderColor3 = Color3.fromRGB(170, 170, 170), PlaceholderText = "Value...", Size = UDim2.fromOffset(200, 35), Text = currentText, TextColor3 = Color3.fromRGB(204, 204, 204), TextSize = 22, }), SetButton = Roact.createElement("TextButton", { BackgroundColor3 = Color3.fromRGB(0, 162, 255), BorderSizePixel = 0, [Roact.Event.Activated] = onSetActivated, Font = Enum.Font.GothamBlack, LayoutOrder = 1, Size = UDim2.fromOffset(100, 35), Text = "Set", TextColor3 = Color3.fromRGB(255, 255, 255), TextSize = 22, }), IncrementButton = Roact.createElement("TextButton", { BackgroundColor3 = Color3.fromRGB(60, 60, 60), BorderSizePixel = 0, [Roact.Event.Activated] = onIncrementActivated, Font = Enum.Font.GothamMedium, LayoutOrder = 2, Size = UDim2.fromOffset(100, 35), Text = "+1", TextColor3 = Color3.fromRGB(204, 204, 204), TextSize = 22, }), DecrementButton = Roact.createElement("TextButton", { BackgroundColor3 = Color3.fromRGB(60, 60, 60), BorderSizePixel = 0, [Roact.Event.Activated] = onDecrementActivated, Font = Enum.Font.GothamMedium, LayoutOrder = 3, Size = UDim2.fromOffset(100, 35), Text = "-1", TextColor3 = Color3.fromRGB(204, 204, 204), TextSize = 22, }), }) end local ValueModifier = Hooks.new(Roact)(Component, { componentType = "PureComponent", name = "ValueModifier", }) local default = ValueModifier return { ValueModifier = ValueModifier, default = default, }