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