local plr = script.Parent.Parent.Parent local char = plr.Character local ropem = nil…
- User
local plr = script.Parent.Parent.Parent local char = plr.Character local ropem = nil local idle = script.idleRope local ft = true local pastpart = nil local maxropes = 50 local count = 0 local firstpart local part local part2 local animtrack = nil
char.Humanoid.FallingDown:Connect(function() if part2 and pastpart and firstpart then wait(1) firstpart.Anchored = false game.Workspace.Ropes:GetChildren().Anchored = false end end)
char.Humanoid.Jumping:Connect(function() if part2 and pastpart and firstpart then firstpart.Anchored = true game.Workspace.Ropes:GetChildren().Anchored = true end end)
script.Parent.Activated:Connect(function() if part ~= nil then if count < maxropes then count = count + 1 if count == 2 then firstpart = pastpart pastpart.CanCollide = false end if pastpart == nil then pastpart = part else pastpart = part2 end part2 = Instance.new("Part", script.Parent.Handle) part2.Transparency = 1 part2.CanCollide = true part2.Size = Vector3.new(0.01,0.01,0.01) local ropec = script.RopeConstraint:Clone() ropec.Parent = pastpart part2.CFrame = pastpart.CFrame local att1 = Instance.new("Attachment", pastpart) local att2 = Instance.new("Attachment", part2) ropec.Attachment1 = att2 ropec.Attachment0 = att1 else script.Parent.Parent:Destroy() end end end)
script.Parent.Unequipped:Connect(function() for i, v in pairs(char.Humanoid:GetPlayingAnimationTracks()) do if v.Name == "idleRope" then v:Stop() end end if ropem == nil then for i, v in pairs(game.Workspace.Ropes:GetChildren()) do v.Parent = game.Workspace end if part2 then part2:Destroy() elseif firstpart then firstpart:Destroy() elseif pastpart then pastpart:Destroy() pastpart = nil end part:Destroy() part = Instance.new("Part", workspace.Ropes) part.Transparency = 1 part.Size = Vector3.new(0.01,0.01,0.01) local att = Instance.new("Attachment",part) script.Parent.Handle.RopeConstraint.Attachment1 = att local att = Instance.new("Attachment",part) ropem = game.ServerStorage.Rope:Clone() local weld = Instance.new("Weld", ropem) ropem.Parent = char weld.Part0 = char.LowerTorso weld.Part1 = ropem weld.C1 = weld.C0 * CFrame.new(0,1,1) * CFrame.Angles(0,math.rad(90),0) end end)
script.Parent.Equipped:Connect(function() if ropem ~= nil or ft == true then part = Instance.new("Part", workspace.Ropes) part.Transparency = 1 part.Size = Vector3.new(0.01,0.01,0.01) local att = Instance.new("Attachment",part) script.Parent.Handle.RopeConstraint.Attachment1 = att part.CanCollide = true part.CFrame = char.HumanoidRootPart.CFrame * CFrame.new(0,1,1) char.Humanoid:LoadAnimation(idle):Play() if ft == false then ropem:Destroy() end ft = false ropem = nil end end) сделай так чтобы когда убираешь веребку она обрезалась, а когда заново берешь она заново начиналась
- Assistant
Чтобы обрезать веревку при убирании, вы можете просто удалить все ее части:
local function ResetRope() -- Удалить все части веревки for _, ropePart in ipairs(workspace.Ropes:GetChildren()) do ropePart:Destroy() end end script.Parent.Unequipped:Connect(ResetRope)Чтобы создать новую веревку, когда она снова берется, вам нужно удалить все старые части, а затем создать новую часть и связать ее с рукояткой:
local function CreateRope() -- Удалить все старые части ResetRope() -- Создать новую часть local part = Instance.new("Part") part.Transparency = 1 -- Настроить размер и расположение новой части -- Создать и настроить новый Attachment для связи с рукояткой -- Связать новую часть с рукояткой -- Установить новую веревку в workspace.Ropes для удобства управления -- Возвращаем созданную веревку return part end script.Parent.Equipped:Connect(CreateRope)Это только примеры кода, и их нужно настроить в соответствии с вашими требованиями и логикой игры.