Hello,
I’m here with another welding issue. I’m making a door gibbing system for my fighting game. When the player gets gets crushed under a door, the script has to go clone a blood particle emitter from server storage and weld it to the torso but of course it does not weld the emitters and they fall down out of the map.
A part of the code is down below:
PS: The issue is not with the anchors, I tried with and without them.
local blood = game:GetService("ServerStorage"):WaitForChild("blood")
local function PlayerTouched(Part)
local Parent = Part.Parent
local plr = game.Players:GetPlayerFromCharacter(Parent)
if game.Players:GetPlayerFromCharacter(Parent) and dbnc == false then
dbnc = true
Parent.Torso.Anchored = true
local g1c = g1:Clone()
g1c.Parent = Parent.Torso
local g2c = g2:Clone()
g2c.Parent = Parent.Torso
local g3c = g3:Clone()
g3c.Parent = Parent.Torso
local b1 = blood:Clone()
b1.Parent = Parent.Torso
local b2 = blood:Clone()
b2.Parent = Parent.Torso
local b3 = blood:Clone()
b3.Parent = Parent.Torso
local b4 = blood:Clone()
b4.Parent = Parent.Torso
local b5 = blood:Clone()
b5.Parent = Parent.Torso
b1.Anchored = true
b1.Position = Parent.Torso.Position + Vector3.new(0, -0.45, -1)
b2.Anchored = true
b2.Position = Parent.Torso.Position + Vector3.new(0, -0.95, 0)
b3.Anchored = true
b3.Position = Parent.Torso.Position + Vector3.new(0, -0.95, 1)
b4.Anchored = true
b4.Position = Parent.Torso.Position + Vector3.new(0, -0.95, -0.488)
b5.Anchored = true
b5.Position = Parent.Torso.Position + Vector3.new(0, -0.95, -0.512)
local w1 = Instance.new("WeldConstraint", Parent.Torso)
w1.Part0 = Parent.Torso
w1.Part1 = Parent.Head
local w2 = Instance.new("WeldConstraint", Parent.Torso)
w2.Part0 = Parent.Torso
w2.Part1 = Parent["Left Arm"]
local w3 = Instance.new("WeldConstraint", Parent.Torso)
w3.Part0 = Parent.Torso
w3.Part1 = Parent["Right Arm"]
local w4 = Instance.new("WeldConstraint", Parent.Torso)
w4.Part0 = Parent.Torso
w4.Part1 = Parent["Left Leg"]
local w5 = Instance.new("WeldConstraint", Parent.Torso)
w5.Part0 = Parent.Torso
w5.Part1 = Parent["Right Leg"]
Parent.Torso.Anchored = false
b1.Anchored = false
b2.Anchored = false
b3.Anchored = false
b4.Anchored = false
b5.Anchored = false
g1c:Play()
g2c:Play()
g3c:Play()
game:GetService("ReplicatedStorage").proximity:FireClient(plr, "Disable")
Parent.Humanoid.BreakJointsOnDeath = true
Parent.Humanoid.Health = 0
script.Parent.Parent.button1.base.ProximityPrompt.Enabled = false
script.Parent.Parent.button2.base.ProximityPrompt.Enabled = false
g1c.Stopped:Wait()
g2c.Stopped:Wait()
g3c.Stopped:Wait()
g1c:Destroy()
g2c:Destroy()
g3c:Destroy()
dbnc = false
end
end
script.Parent.Touched:Connect(PlayerTouched)
Thanks in advance.