Hello So I’ll be simple, sometimes my cuffs works 100% but other times, like if the weld was “laggy”
Sometimes it doesn’t lag’s and you can move and the other player moves too but not laggy, but this time, yep, it like it’s slow, anything else I could use except of weld? to make the player moves along with the officer cuffing him? Without using a loop! or anyway to improve my script?
How it should work: https://gyazo.com/e4adbd52e7649e8774b769c4697e55d4
How sometimes works (wrong): https://gyazo.com/074cc892a013eed74b118d535a7c4e49
function PinPlayer(Pinner, Pinned)
if not Pinned.Character:FindFirstChild("Pinned") then
game.ReplicatedStorage.Events.Notifcation:FireClient(Pinned, "Cuffed", "LTAA Will result in 20 minutes of jail ", 10)
local Value = Instance.new("ObjectValue", Pinned.Character)
Value.Name = "Pinned"
tarr = Pinned
off = Pinner
Pinned.Character.Humanoid.PlatformStand = true
local aw = Pinned.Character.Humanoid:LoadAnimation(PinnedAnim)
local Value2 = Instance.new("StringValue", Pinner.Character)
Value2.Name = "Grabbing"
aw:Play()
Pinned.PlayerGui.Backpack.Enabled = false
Pinned.PlayerGui.Backpack.Frame.LocalScript.Disabled = true
local Cuffs = script.Cuffs:Clone();
Cuffs.Parent = Pinned.Character;
local CuffWeld = Instance.new("Weld", Cuffs);
CuffWeld.Part0 = Cuffs.Union;
CuffWeld.Part1 = Pinned.Character.UpperTorso;
CuffWeld.C1 = CFrame.new(0,-0.8,1.50) * CFrame.Angles(math.rad(0), math.rad(90), math.rad(0))
local Weld = Instance.new("Weld", Pinner.Character)
Weld.Name = "InteractWeld"
Weld.Part0 = Pinner.Character.HumanoidRootPart
Weld.Part1 = Pinned.Character.HumanoidRootPart
Value.Value = Weld
Value2.Value = Pinned.Name
Pinned.Character.Humanoid:UnequipTools()
Weld.C1 = CFrame.new(0,0,2.5)
elseif Pinned.Character:FindFirstChild("Pinned") or Pinner.Character:FindFirstChild("InteractWeld") then
game.ReplicatedStorage.Events.Notifcation:FireClient(Pinned, "Released", "You're free to go.", 10)
for i,v in pairs(Pinned.Character.Humanoid:GetPlayingAnimationTracks()) do
v:Stop()
end
tarr = nil
off = nil
if Pinned.Character:FindFirstChild("Pinned") then
Pinned.Character:FindFirstChild("Pinned"):Destroy()
end
if Pinner.Character:FindFirstChild("Grabbing") or Pinner.Character:FindFirstChild("InteractWeld") or Pinned.Character:FindFirstChild("Pinned") then
for i,v in pairs(Pinner.Character:GetChildren()) do
if v.Name == "Pinned" or v.Name == "Grabbing" or v.Name == "InteractWeld" then
v:Destroy()
end
end
for i,v in pairs(Pinned.Character:GetChildren()) do
if v.Name == "Pinned" or v.Name == "Grabbing" or v.Name == "InteractWeld" or v.Name == "Cuffs" then
v:Destroy()
end
end
end
Pinned.Character.Humanoid.WalkSpeed = 16
Pinned.PlayerGui.Backpack.Enabled = true
Pinned.PlayerGui.Backpack.Frame.LocalScript.Disabled = false
Pinned.Character.Humanoid.PlatformStand = false
for i,v in pairs(Pinned.Character.Humanoid:GetPlayingAnimationTracks()) do
v:Stop()
end
end
end
The important stuff it’s on the local “Weld” that’s what it lags