New paste
Recent
API
Trending
Blog
Guest
Sign Up or Login
Login
Sign Up
New Paste
Syntax Highlighting
local Players = game:GetService("Players") local UserInputService = game:GetService("UserInputService") local ReplicatedStorage = game:GetService("ReplicatedStorage") local StarterGui = game:GetService("StarterGui") print("--- ЗАПУСК КОНТРОЛЛЕРА (v16: Mana Cost Display) ---") local player = Players.LocalPlayer local gui = script.Parent local hotbar = gui:WaitForChild("Hotbar") local menuFrame = gui:WaitForChild("AbilityMenu") local openMenuBtn = gui:WaitForChild("OpenMenuBtn") local AbilitiesFolder = ReplicatedStorage:WaitForChild("Abilities") -- ССЫЛКИ НА ПАНЕЛИ local leftPanel = menuFrame:WaitForChild("LeftPanel") local rightPanel = menuFrame:WaitForChild("RightPanel") local titleLabel = rightPanel:WaitForChild("TitleText") local descLabel = rightPanel:WaitForChild("DescText") -- [НОВОЕ] Ищем текст цены маны (создай его в GUI!) local costLabel = rightPanel:FindFirstChild("CostText") local resetButton = menuFrame:FindFirstChild("ResetButton") or leftPanel:FindFirstChild("ResetButton") or rightPanel:FindFirstChild("ResetButton") local menuButtonsMap = {} -- ============================================================== -- 1. ВИЗУАЛ (Таймер и Затемнение) -- ============================================================== local function PlayCooldownAnimation(slotBtn, duration) local cdFrame = slotBtn:FindFirstChild("CooldownOverlay") if not cdFrame then cdFrame = Instance.new("Frame"); cdFrame.Name = "CooldownOverlay"; cdFrame.Size = UDim2.new(1,0,1,0); cdFrame.BackgroundTransparency = 0.3; cdFrame.BackgroundColor3 = Color3.new(0,0,0); cdFrame.ZIndex=10; cdFrame.Parent = slotBtn local c = Instance.new("UICorner", cdFrame); c.CornerRadius = UDim.new(0,8) local t = Instance.new("TextLabel", cdFrame); t.Name="TimerText"; t.Size=UDim2.new(0.5,0,0.5,0); t.Position=UDim2.new(0.25,0,0.25,0); t.BackgroundTransparency=1; t.TextColor3=Color3.new(1,1,1); t.TextScaled=true; t.Font=Enum.Font.GothamBold; t.ZIndex=11 end local textLabel = cdFrame.TimerText; cdFrame.Visible = true task.spawn(function() local s = tick() while tick()-s < duration do local left = duration-(tick()-s) textLabel.Text = (left<1) and string.format("%.1f", left) or math.ceil(left) task.wait(0.1) end cdFrame.Visible = false end) end local function SetAbilityEquipped(abilityName, isEquipped) local btn = menuButtonsMap[abilityName] if btn then btn.ImageColor3 = isEquipped and Color3.new(0.4, 0.4, 0.4) or Color3.new(1, 1, 1) end end -- ============================================================== -- 2. СБРОС -- ============================================================== local currentLoadout = {} local cooldowns = {} if resetButton then resetButton.MouseButton1Click:Connect(function() for abilityName, _ in pairs(currentLoadout) do SetAbilityEquipped(abilityName, false) end currentLoadout = {} for _, child in pairs(hotbar:GetChildren()) do if child:IsA("ImageButton") or child:IsA("TextButton") then child.Image = "" local overlay = child:FindFirstChild("CooldownOverlay") if overlay then overlay.Visible = false end end end titleLabel.Text = "Выберите способность" descLabel.Text = "Нажмите на иконку слева..." if costLabel then costLabel.Text = "" end end) end -- ============================================================== -- 3. ЗАГРУЗКА -- ============================================================== openMenuBtn.MouseButton1Click:Connect(function() menuFrame.Visible = not menuFrame.Visible end) local AbilityModules = {} local selectedAbilityName = nil if costLabel then costLabel.Text = "" end -- Очищаем цену при старте for _, module in pairs(AbilitiesFolder:GetChildren()) do if module:IsA("ModuleScript") then local success, result = pcall(function() return require(module) end) if success then AbilityModules[module.Name] = result local btnName = module.Name .. "Icon" local btn = leftPanel:FindFirstChild(btnName) if btn then menuButtonsMap[module.Name] = btn btn.MouseButton1Click:Connect(function() selectedAbilityName = module.Name -- ОБНОВЛЯЕМ ИНФОРМАЦИЮ titleLabel.Text = result.Info.Name or module.Name descLabel.Text = result.Info.Description or "Нет описания" -- [НОВОЕ] Показываем цену маны if costLabel then local cost = result.Info.ManaCost or 0 costLabel.Text = "Мана: " .. cost -- Если мана бесплатная, можно писать "Бесплатно" if cost == 0 then costLabel.Text = "Мана: 0 (Бесплатно)" end end print("🔵 Инфо обновлено: " .. module.Name) end) end end end end -- ============================================================== -- 4. СЛОТЫ -- ============================================================== for _, child in pairs(hotbar:GetChildren()) do if child:IsA("ImageButton") or child:IsA("TextButton") then child.MouseButton1Click:Connect(function() if selectedAbilityName then local module = AbilityModules[selectedAbilityName] if not module or not module.Info then return end local oldAbility = currentLoadout[child.Name] if oldAbility then SetAbilityEquipped(oldAbility, false) end for slot, ability in pairs(currentLoadout) do if ability == selectedAbilityName then currentLoadout[slot] = nil local oldBtn = hotbar:FindFirstChild(slot) if oldBtn then oldBtn.Image = "" end end end currentLoadout[child.Name] = selectedAbilityName child.Image = module.Info.Icon SetAbilityEquipped(selectedAbilityName, true) selectedAbilityName = nil end end) end end -- ============================================================== -- 5. АКТИВАЦИЯ -- ============================================================== local ControllerAPI = {} function ControllerAPI.ShowNotification(text) StarterGui:SetCore("SendNotification", {Title = "Ability"; Text = text; Duration = 2;}) end local keyMap = { [Enum.KeyCode.E] = "Slot1", [Enum.KeyCode.R] = "Slot2", [Enum.KeyCode.X] = "Slot3", [Enum.KeyCode.F] = "Slot4", [Enum.KeyCode.V] = "Slot5", [Enum.KeyCode.C] = "Slot6" } UserInputService.InputBegan:Connect(function(input, gp) if gp then return end local slotName = keyMap[input.KeyCode] if slotName then local abilityName = currentLoadout[slotName] if abilityName and AbilityModules[abilityName] then local module = AbilityModules[abilityName] -- Проверка маны local char = player.Character if char then local currentMana = char:GetAttribute("Mana") or 0 local manaCost = module.Info.ManaCost or 0 if currentMana < manaCost then ControllerAPI.ShowNotification("Мана: " .. math.floor(currentMana) .. "/" .. manaCost) return end end local lastTime = cooldowns[abilityName] or 0 local cdTime = module.Info.Cooldown or 0 if tick() - lastTime < cdTime then return end local success = module.Activate(ControllerAPI) if success ~= false then cooldowns[abilityName] = tick() local slotBtn = hotbar:FindFirstChild(slotName) if slotBtn then PlayCooldownAnimation(slotBtn, cdTime) end end end end end)
Optional Gist Settings
Gist Name/Title:
Category:
None
Cryptocurrency
Cybersecurity
Fixit
Food
Gaming
Haiku
Help
History
Housing
Jokes
Legal
Money
Movies
Music
Pets
Photo
Science
Software
Source Code
Spirit
Sports
Travel
TV
Writing
Syntax Highlighting:
None
Bash
C
C++
C#
CSS
HTML
Java
JavaScript
Lua
Objective C
Perl
PHP
Python
Ruby
JSON
Swift
Markdown
ActionScript
Ada
Apache Log
AppleScript
ASM (NASM)
ASP
Bash
C
C for Macs
CAD DCL
CAD Lisp
C++
C#
ColdFusion
CSS
D
Delphi
Diff
Batch
Eiffel
Fortran
FreeBasic
Game Maker
HTML
INI file
Java
JavaScript
Lisp
Lua
MPASM
MySQL
NullSoft Installer
Objective C
OCaml
Openoffice BASIC
Oracle 8
Pascal
Perl
PHP
Python
QBasic
Robots
Ruby
Scheme
Smarty
SQL
VisualBasic
VB.NET
VisualFoxPro
XML
AutoIt
Blitz Basic
BNF
Erlang
Genero
Groovy
Haskell
Inno Script
Latex
Linden Scripting
MatLab
M68000 Assembler
mIRC
Rails
PL/SQL
Smalltalk
TCL
Z80 Assembler
ABAP
ActionScript 3
APT Sources
Avisynth
Basic4GL
BibTeX
BrainFuck
BOO
CFDG
C Intermediate Language
CMake
COBOL
DCS
DIV
DOT
Email
FO Language
GetText
OpenGL Shading
Ruby Gnuplot
HQ9 Plus
IDL
INTERCAL
IO
Java 5
KiXtart
Clone C
Clone C++
Loco Basic
LOL Code
Lotus Formulas
Lotus Script
LScript
Make
Modula 3
MXML
Oberon 2
OCaml Brief
Oracle 11
Per
PHP Brief
Pic 16
Pixel Bender
POV-Ray
PowerShell
Progress
Prolog
Properties
ProvideX
REBOL
REG
SAS
Scala
Scilab
SdlBasic
Tera Term
thinBasic
T-SQL
TypoScript
VeriLog
VHDL
VIM
Visual Pro Log
WhiteSpace
WHOIS
Winbatch
Xorg Config
XPP
Pawn
4CS
6502 ACME Cross Assembler
6502 Kick Assembler
6502 TASM/64TASS
Motorola 68000 HiSoft Dev
ALGOL 68
autoconf
Autohotkey
Awk
Cuesheet
ChaiScript
Clojure
C++ (with Qt extensions)
E
ECMAScript
Formula One
F#
GAMBAS
GDB
Genie
Go
GwBasic
HicEst
Icon
J
jQuery
Liberty BASIC
Logtalk
MagikSF
MapBasic
MIX Assembler
Modula 2
newLISP
Objeck Programming Language
Oz
Delphi Prism (Oxygene)
Oz
PCRE
Perl 6
OpenBSD PACKET FILTER
Pike
PostgreSQL
PowerBuilder
PureBasic
q/kdb+
RPM Spec
R
SystemVerilog
Vala
Unicon
Vala
XBasic
ZXBasic
UnrealScript
HTML 5
ProFTPd
BASCOM AVR
C: Loadrunner
CoffeeScript
EPC
Falcon
LLVM
PyCon
YAML
FreeSWITCH
ARM
Asymptote
DCL
DCPU-16
Haxe
LDIF
Nagios
Octave
ParaSail
PARI/GP
Python for S60
Rexx
SPARK
SPARQL
StoneScript
UPC
Urbi
Vedit
AIMMS
Chapel
Dart
Easytrieve
ISPF Panel Definition
JCL
Nginx
Nim
PostScript
QML
Racket
RBScript
Rust
SCL
StandardML
VBScript
C (WinAPI)
C++ (WinAPI)
NetRexx
JSON
Swift
SuperCollider
Julia
Blitz3D
BlitzMax
SQF
Puppet
Filemaker
Euphoria
PL/I
Open Object Rexx
Markdown
Kotlin
Ceylon
Arduino
YARA
TypeScript
Mercury
MetaPost
MK-61/52
Phix
Roff Manpage
SSH Config
TeXgraph
Xojo
KSP (Kontakt Script)
GDScript
Godot GLSL
None
Tags:
Gist Exposure:
Public
Unlisted
Private
Gist Expiration:
Never
Burn after read
10 Minutes
1 Hour
1 Day
1 Week
2 Weeks
1 Month
6 Months
1 Year
Password
Enabled
Disabled
Folder:
(members only)
Burn after read
Create New Gist
You are currently not logged in, this means you can not edit or delete anything you paste.
Sign Up
or
Login
Public Gists
Collection of Links for Norton Setup and Cancellation Guides
None | 3 hours ago | 8 Views
Untitled Paste
None | 21 hours ago | 13 Views
for maria
TypeScript | 1 day ago | 23 Views
Flight Details for Stefan Heinrich
None | 1 day ago | 28 Views
Details zur elektrischen Mobilitätshilfe
None | 1 day ago | 19 Views
bash flock protected logging v3
Bash | 1 day ago | 23 Views
bash flock protected logging v2
Bash | 1 day ago | 19 Views
Not a member of GistPad yet?
Sign Up
, it unlocks many cool features!
We use cookies for various purposes including analytics. By continuing to use GistPad, you agree to our use of cookies as described in the
Privacy Policy
.
OK, I Understand