Skip to content
TheChatArchiveThe Chat Archive
gpt-3.5-turbo-0613· openaiHugging Face Suzhen/CodeChat

local plr = script.Parent.Parent.Parent local char = plr.Character local ropem = nil…

  1. 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) сделай так чтобы веревка после того как убирается в инвентарь (она в этом скрипте автоматически обрезается), а когда ее достают она заново выкладывается (тоесть от корня, все заново)

  2. Assistant

    To make the rope automatically reset when it is unequipped and reappear when it is equipped, you can modify the "Equipped" and "Unequipped" functions in your code. Here's an updated version of the code:

    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
    	
    	for i, v in pairs(game.Workspace.Ropes:GetChildren()) do
    		v.Parent = game.Workspace
    	end
    	
    	if part2 then
    		part2:Destroy()
    	end
    	
    	if firstpart then
    		firstpart:Destroy()
    	end
    	
    	if pastpart then
    		pastpart:Destroy()
    		pastpart = nil
    	end
    	
    	if part then
    		part:Destroy()
    	end
    end)
    
    script.Parent.Equipped:Connect(function()
    	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()
    end)
    

    In the "Unequipped" function, we are now destroying all existing rope parts and resetting the arrays and variables.

    In the "Equipped" function, we are creating a new rope part and setting its position based on the character's HumanoidRootPart. We also play the idle animation for the rope.

    Note: Make sure you have a folder named "Ropes" in your Workspace for the rope parts to be parented to.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.