Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Ragdoll on explosion touch?

Asked by 3 years ago
Edited 3 years ago

Hi, i am trying to make a simular game like R2DA I am currently trying to make it so when you touch a explosion you ragdoll but i cant get anything to work

This is the script im working with the script is located in StarterCharacterScripts and its a script not a localscript

local RemoteEvent = workspace.Part.RemoteEvent
local humanoid = script.Parent:WaitForChild("Humanoid")

RemoteEvent.OnServerEvent:Connect(function(ragdoll)
        humanoid.BreakJointsOnDeath = false
        for index, joint in pairs(script.Parent:GetDescendants()) do
            if joint:IsA("Motor6D") then
                local socket = Instance.new("BallSocketConstraint")
                local a1 = Instance.new("Attachment")
                local a2 = Instance.new("Attachment")
                a1.Parent = joint.Part0
                a2.Parent = joint.Part1
                socket.Parent = joint.Parent
                socket.Attachment0 = a1
                socket.Attachment1 = a2
                a1.CFrame = joint.C0
                a2.CFrame = joint.C1
                socket.LimitsEnabled = true
                socket.TwistLimitsEnabled = true
                joint:Destroy()
            end
        end
    end)
end)

this is the part script for detecting the player touching the explosion the script is located in part also a script not a localscript

local thing = script.Parent
local humanoid = game.Players.LocalPlayer:WaitForChild("Humanoid")
local remoteEvent = thing:WaitForChild("RemoteEvent")

thing.Touched:Connect(function(touch)
    if touch.Parent:FindFirstChild("Humanoid") then
        local exploding = Instance.new("Explosion")
        exploding.DestroyJointRadiusPercent = 0
        exploding.Parent = workspace
        exploding.Position = thing.Position
        exploding.Hit:Connect(function(touch2)
            if touch2.Parent:FindFirstChild("Humanoid") then
                remoteEvent:FireServer()
            end 
        end)
    end
end)

Im trying to make it so when the player touches a explosion it fires a remote event which makes the player ragdoll

Any help please?

(sorry if there are grammer mistakes my english is not the best)

1 answer

Log in to vote
0
Answered by 3 years ago

Never mind i found a solution

Ad

Answer this question