Not a member of gistpad yet?
Sign Up,
it unlocks many cool features!
- local ReplicatedStorage = game:GetService("ReplicatedStorage")
- local AstralEvent = ReplicatedStorage:WaitForChild("AstralEvent")
- print("👻 Скрипт Астрала (с Маной) загружен")
- -- === НАСТРОЙКА ЦЕНЫ ===
- local MANA_COST = 30 -- Должно совпадать с ModuleScript!
- local activeBodies = {}
- local function setGhostVisuals(char, isGhost)
- local transparency = isGhost and 0.6 or 0
- for _, part in pairs(char:GetDescendants()) do
- if part:IsA("BasePart") and part.Name ~= "HumanoidRootPart" then
- part.Transparency = transparency
- elseif part:IsA("Decal") then
- part.Transparency = transparency
- end
- end
- end
- AstralEvent.OnServerEvent:Connect(function(player)
- local character = player.Character
- if not character then return end
- local rootPart = character:FindFirstChild("HumanoidRootPart")
- local humanoid = character:FindFirstChild("Humanoid")
- if activeBodies[player] then
- -- === ВЫХОД ИЗ АСТРАЛА (БЕСПЛАТНО) ===
- local oldBody = activeBodies[player]
- if oldBody and oldBody:FindFirstChild("HumanoidRootPart") then
- rootPart.CFrame = oldBody.HumanoidRootPart.CFrame
- end
- if oldBody then oldBody:Destroy() end
- activeBodies[player] = nil
- setGhostVisuals(character, false)
- local ff = character:FindFirstChild("AstralShield")
- if ff then ff:Destroy() end
- humanoid.DisplayName = player.DisplayName
- else
- -- === ВХОД В АСТРАЛ (ПЛАТНО) ===
- -- [СПИСАНИЕ МАНЫ]
- local currentMana = character:GetAttribute("Mana") or 0
- if currentMana < MANA_COST then return end -- Защита
- character:SetAttribute("Mana", currentMana - MANA_COST)
- -- Логика входа
- character.Archivable = true
- local bodyClone = character:Clone()
- bodyClone.Name = "Body_" .. player.Name
- for _, obj in pairs(bodyClone:GetDescendants()) do
- if obj:IsA("Script") or obj:IsA("LocalScript") or obj:IsA("Tool") then obj:Destroy() end
- end
- for _, part in pairs(bodyClone:GetDescendants()) do
- if part:IsA("BasePart") then part.Anchored = true; part.CanCollide = false end
- end
- bodyClone.Parent = workspace
- bodyClone:SetPrimaryPartCFrame(rootPart.CFrame)
- activeBodies[player] = bodyClone
- setGhostVisuals(character, true)
- local ff = Instance.new("ForceField")
- ff.Name = "AstralShield"; ff.Visible = false; ff.Parent = character
- humanoid.DisplayName = "👻 Spirit"
- end
- end)
- game.Players.PlayerRemoving:Connect(function(player)
- if activeBodies[player] then activeBodies[player]:Destroy() end
- end)
RAW Gist Data
Copied
