I am currently working on a taser tool for a game. When you click on the player, it can ragdoll them just fine. But after adding the cosmetic spring to represent the wires coming from the taser, the ragdoll broke. They still have all of the joints from a ragdoll but can still move and the torso remains in the same position. I have no idea where to go from here.
local tool = script.Parent
local module = require(game.ServerScriptService.Modules.RagdollModule)
tool.Fire.OnServerEvent:Connect(function(player, target)
if target == nil then return end
local char = target.Parent
local victimPlayer = game:GetService("Players"):GetPlayerFromCharacter(char)
if target == player.Character or player:FindFirstChild("PvpEnabled") == false then return end
tool.Muzzle.Taser:Play()
tool.Muzzle.ParticleEmitter.Enabled = true
if target.Parent:FindFirstChild("Humanoid") then
if victimPlayer:FindFirstChild("PvpEnabled") == false then return end
victimPlayer:FindFirstChild("Downed").Value = true
local connection0 = Instance.new("Attachment")
connection0.Parent = target
local connection1 = Instance.new("Attachment")
connection1.Parent = tool.Muzzle
local rope = Instance.new("SpringConstraint")
rope.Attachment0 = connection0
rope.Attachment1 = connection1
rope.Parent = player.Character
rope.Color = BrickColor.new("Electric blue")
rope.Stiffness = 20
rope.Visible = true
module.Ragdoll(char, victimPlayer)
wait(tool.Muzzle.Taser.TimeLength)
tool.Muzzle.ParticleEmitter.Enabled = false
connection1:Destroy()
connection0:Destroy()
rope:Destroy() --they only fall over after this point and act like how i described before here
wait(10)
module.Stand(char, victimPlayer, char.Humanoid)
victimPlayer:FindFirstChild("Downed").Value = false
else
wait(tool.Muzzle.Taser.TimeLength)
tool.Muzzle.ParticleEmitter.Enabled = false
end
end)