Hello Everyone!
I needed to make a leash for carry every kind of custom rig, but i don’t know how!
So, i found a model that works good, but i needed to do some modifications… And i just messed it up!
Here is what happens: https://streamable.com/w6jgei
And here is the modified model (feel free to take it and do what you need):
HumanoidLeash - Roblox
I want to make the leash model work something like this:
But not with smart movements
Scripts
Explorer view:
Global_Script
-- this is the script responsible for creating the actual leash
function script.Parent.Leash_Event.OnServerInvoke(plr, target)
print("Recieved Request!")
local attachment0 = Instance.new("Attachment", script.Parent.Handle)
local attachment1 = Instance.new("Attachment", target.Parent.HumanoidRootPart) --r15 doesn't have just one torso.
local leash = Instance.new("RodConstraint", script.Parent.Handle)
print("Variables Set!")
leash.Color = BrickColor.new("Brown")
leash.Attachment0 = attachment0
leash.Attachment1 = attachment1
leash.Visible = true
leash.Length = 40
print("Leash Settings Set!")
target.JumpPower = 50
target.WalkSpeed = 16
target.Sit = false
print("Immobalized Humanoid!")
if not (target.Parent.HumanoidRootPart:FindFirstChild("Leash_Force")) then --makes sure it doesn't dupe it
print("Elevating Humanoid!")
local bodyforce = Instance.new("BodyForce")
bodyforce.Name = "Leash_Force"
bodyforce.Parent = target.Parent.HumanoidRootPart --r15 doesn't have just one torso.
bodyforce.Force = Vector3.new(0, target.Parent.HumanoidRootPart:GetMass()*500000, 0) --insane amounts for extra lulz
end
end
script.Parent.Unequipped:Connect(function()
if (script.Parent.Handle:FindFirstChildOfClass("RopeConstraint")) then
if (script.Parent.Handle.RopeConstraint.Attachment1) and (script.Parent.Handle.RopeConstraint.Attachment0) then
if (script.Parent.Handle.RopeConstraint.Attachment1.Parent:FindFirstChild("Leash_Force")) then
script.Parent.Handle.RopeConstraint.Attachment1.Parent.Parent.Humanoid.Sit = false
script.Parent.Handle.RopeConstraint.Attachment1.Parent.Parent.Humanoid.JumpPower = 50
script.Parent.Handle.RopeConstraint.Attachment1.Parent.Parent.Humanoid.WalkSpeed = 16
script.Parent.Handle.RopeConstraint.Attachment1.Parent.Leash_Force:Destroy()
script.Parent.Handle.RopeConstraint.Attachment1:Destroy()
script.Parent.Handle.RopeConstraint.Attachment0:Destroy()
script.Parent.Handle.RopeConstraint:Destroy()
end
end
end
end)
-- goes through a crapton of parameters to check for no errors, and then completely clears out any sign of the rope.
Local_Script
-- this is the script responsible for getting which players you want to "leash"
script.Parent.Equipped:Connect(function(mouse)
mouse.Button1Down:Connect(function()
print("Activated")
local target = mouse.Target.Parent or mouse.Target.Parent.Parent
local humanoid = target:FindFirstChildOfClass("Humanoid") --uses findfirstchildofclass "just because" ;)
if humanoid and humanoid ~= (game.Players.LocalPlayer.Character:FindFirstChildOfClass("Humanoid")) and not (script.Parent.Parent.HumanoidRootPart:FindFirstChild("Leash_Force")) and target.HumanoidRootPart.Anchored ~= true and not (target.HumanoidRootPart:FindFirstChild("Leash_Force")) then
print("Sent Request")
script.Parent.Leash_Event:InvokeServer(humanoid)
end
end)
end)
--[[
the above "if" statement makes sure that;
1. It's an actual player;
2. You're not leashing yourself;
3. You can't leash while being leashed;
4. You're not leashing someone that's anchored, getting you stuck;
5. You can't leash anyone already leashed.
]]--
Please have in mind that my scripting knowledges are super small
Thank You!