I am trying to make a Ragdoll grappling hook but I don’t know which Ragdoll script for r6 and how to activate the ragdoll when the tool click is held.
I tried a few R6 ragdoll scripts but none of them worked. I tried searching for answers but nothing.
Here is the Grapple Tool ModuleScript:
local RunService = game:GetService(“RunService”)
local Players = game:GetService(“Players”)
local TweenService = game:GetService(“TweenService”)local tool = script.Parent
local base = tool:WaitForChild(“Base”)
local spring = base.Spring
local hook = tool:WaitForChild(“Hook”)
local hookWeld = hook.HookWeld
local hookReference = tool:WaitForChild(“HookReference”)
local messageEvent = script:WaitForChild(“MessageEvent”)
local activated = script:WaitForChild(“Activated”)–ONLY CLIENT
local player = nil
local mouse = nil
local currentTween = nillocal GrappleGun = {}
local function toggleHumanoidGrappleState(active)
local humanoid = player.Character and player.Character:FindFirstChild(“Humanoid”)if humanoid then
if active then humanoid:SetStateEnabled(Enum.HumanoidStateType.Running, false) humanoid:ChangeState(Enum.HumanoidStateType.Physics) else humanoid:SetStateEnabled(Enum.HumanoidStateType.Running, true) humanoid:ChangeState(Enum.HumanoidStateType.GettingUp) end
end
endlocal function clientInit()
player = Players.LocalPlayer
mouse = player:GetMouse()mouse.TargetFilter = player.Character
tool.Activated:Connect(function()
if not GrappleGun.IsActivated() and mouse.Target then
messageEvent:FireServer(true, mouse.Hit.Position)
toggleHumanoidGrappleState(true)
end
end)tool.Deactivated:Connect(function()
messageEvent:FireServer(false)
toggleHumanoidGrappleState(false)
end)tool.Unequipped:Connect(function()
messageEvent:FireServer(false)
toggleHumanoidGrappleState(false)
end)end
local function serverInit()
messageEvent.OnServerEvent:Connect(function(player, _activated, targetPosition)
activated.Value = _activatedif GrappleGun.IsActivated() then GrappleGun.Fire(targetPosition) else GrappleGun.Reset() end
end)
end
local function init()
if RunService:IsClient() then
clientInit()
elseif RunService:IsServer() then
serverInit()
end
endfunction GrappleGun.IsActivated()
return activated.Value
endfunction GrappleGun.Fire(targetPosition)
local initalPos = hookReference.Positionlocal distance = (targetPosition - initalPos).Magnitude
hookWeld.Enabled = false
hook.Anchored = truewait()
hook.Position = targetPosition
spring.FreeLength = distancelocal info = TweenInfo.new(distance/100, Enum.EasingStyle.Linear)
local tween = TweenService:Create(spring, info, {FreeLength = 1})tween:Play()
currentTween = tween
endfunction GrappleGun.Reset()
if currentTween then
currentTween:Cancel()
endhook.CFrame = hookReference.CFrame
hookWeld.Enabled = true
hook.Anchored = falsespring.FreeLength = 1
endinit()
return GrappleGun