Why did my code broke after I came back like wiliam aften

here’s my server script rope code

local lasttarget 
local attached = false
local plar

script.Parent.RemoteEvent.OnServerEvent:Connect(function(hit,target)

	local rope = Instance.new("RopeConstraint")
	rope.Name = "Rope"
	rope.Parent = script.Parent.Parent.HumanoidRootPart
	local attachtor = Instance.new("Attachment")
	attachtor.Parent = script.Parent.Parent.HumanoidRootPart
	rope.Attachment0 = attachtor
	local attach2 = Instance.new("Attachment")
	attach2.Parent = target
	rope.Attachment1 = attach2
	rope.Visible = true
	rope.Length = 10
	rope.Thickness = .3
	script.Parent.Enabled = false
	--	script.Parent.Parent.Humanoid:UnequipTools()
	if target:FindFirstChild("Money") then
		target.CollectScript.Disabled = true
		target.Money.Name = "PetDollar"
		target.Name = "PetDollar"
		local cln = game.ServerStorage.Hearts:Clone()
		cln.Parent = target
	end
	
	attached = true

	lasttarget = target

	if target.Parent:FindFirstChildWhichIsA("Humanoid") then
		target.Parent:FindFirstChildWhichIsA("Humanoid").JumpHeight = 0
		local c=coroutine.create(function()
			repeat
				wait(.2)
				target.Parent:WaitForChild("HumanoidRootPart"):SetNetworkOwner(nil)
				target.Parent:FindFirstChildWhichIsA("Humanoid"):ChangeState(Enum.HumanoidStateType.Seated)
				target.Parent:FindFirstChildWhichIsA("Humanoid").Sit = true
				target.Parent:FindFirstChildWhichIsA("Humanoid"):SetStateEnabled(Enum.HumanoidStateType.GettingUp,false)
				wait()
				target.Parent:WaitForChild("HumanoidRootPart"):SetNetworkOwner(hit)

			until attached == false
		end)
		
		coroutine.resume(c)
		--target.Parent:FindFirstChildWhichIsA("Humanoid").Sit = true
		lasttarget = target.Parent:FindFirstChildWhichIsA("Humanoid")
		lasttarget.Sit = true
		print(lasttarget.Name)
	end

end)

script.Parent.Activated:Connect(function(hit)
	if script.Parent.Parent.HumanoidRootPart:FindFirstChild("Rope") then
		script.Parent.Parent.HumanoidRootPart.Rope:Remove()
		attached = false
		if lasttarget:IsA("Humanoid") then
			--lasttarget.Parent:WaitForChild("HumanoidRootPart"):SetNetworkOwner(nil)
			lasttarget.JumpHeight = game.StarterPlayer.CharacterJumpHeight
			lasttarget.Sit = false
			lasttarget:SetStateEnabled(Enum.HumanoidStateType.GettingUp,true)
			--lasttarget:ChangeState(Enum.HumanoidStateType.GettingUp)
			--lasttarget.Sit = false
			print(lasttarget.Name)
		end
	end
end)

here’s my client rope code

local plr = game.Players.LocalPlayer:GetMouse()
local rope = false

script.Parent.Activated:Connect(function(hit)
	wait(.1)
	local target = plr.Target
	if rope == false and target and game.Players.LocalPlayer:DistanceFromCharacter(target.Position) <= 30 then
		if target.Anchored == false and not target:FindFirstChild("Rope") then
			rope = true
			script.Parent.RemoteEvent:FireServer(target)
		end
	else
		rope = false
		script.Parent.norope:FireServer()
	end

end)

I don’t know why I made it so complicated at the time

how long ago did you make this? Are there any errors?

uhhhhhh idk like 2 yers ago or three?

there’s none at all

well the reason your code broke is because its outdated, figuring out how to fix it may take a while. Ill try and figure it out

ok if it doens’t get fixed I’ll just recode it in a 10x better way in two second

yeah probably just do that straight up, itd probably be easier

1 Like

ok I will

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.