Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Ragdoll on explosion touch?

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

This discussion is preserved as it was. New answers, comments, and votes are closed.