Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local player = game.Players.LocalPlayer
- local char = player.Character
- local rootPart = char and char:FindFirstChild("HumanoidRootPart")
- local tool
- for i, v in player:GetDescendants() do
- if v.Name == "SyncAPI" then
- tool = v.Parent
- end
- end
- for i, v in game.ReplicatedStorage:GetDescendants() do
- if v.Name == "SyncAPI" then
- tool = v.Parent
- end
- end
- remote = tool.SyncAPI.ServerEndpoint
- function _(args) remote:InvokeServer(unpack(args)) end
- function ApplyChanges(part, size, color, material)
- if not part then return end
- for i = 1, 3 do -- Повторяем 3 раза для надежности
- task.wait(0.1)
- local argsResize = {
- [1] = "SyncResize",
- [2] = {
- [1] = {
- ["Part"] = part,
- ["CFrame"] = part.CFrame,
- ["Size"] = size
- }
- }
- }
- _(argsResize)
- local argsColor = {
- [1] = "SyncColor",
- [2] = {
- [1] = {
- ["Part"] = part,
- ["Color"] = color,
- ["UnionColoring"] = false
- }
- }
- }
- _(argsColor)
- local argsMaterial = {
- [1] = "SyncMaterial",
- [2] = {
- [1] = {
- ["Part"] = part,
- ["Material"] = material
- }
- }
- }
- _(argsMaterial)
- end
- end
- function FindLastCreatedPart()
- task.wait(0.1) -- Даем время на создание
- local lastPart = nil
- for _, v in workspace:GetChildren() do
- if v:IsA("BasePart") and v.Parent == workspace then
- lastPart = v -- Берем последний найденный парт
- end
- end
- return lastPart
- end
- function CreatePart(cf, size, color, material)
- local args = {
- [1] = "CreatePart",
- [2] = "Normal",
- [3] = cf,
- [4] = workspace
- }
- _(args)
- task.wait(0.2) -- Ждем появления парта
- local newPart = FindLastCreatedPart()
- if newPart then
- print("Создан парт:", newPart)
- ApplyChanges(newPart, size, color, material)
- return newPart
- else
- print("Ошибка: парт не найден после создания!")
- return nil
- end
- end
- function DestroyPart(part)
- if part then
- local args = {
- [1] = "Remove",
- [2] = { [1] = part }
- }
- _(args)
- end
- end
- local lastSlime
- while true do
- task.wait(0.00000000000000000000000000001)
- if rootPart then
- local newCF = rootPart.CFrame * CFrame.new(0, -3, 0)
- local newSlime = CreatePart(newCF, Vector3.new(8.2, 0.2, 8.2), Color3.fromRGB(0, 0, 0), "Foil")
- if lastSlime then
- DestroyPart(lastSlime)
- end
- lastSlime = newSlime
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment