✓ Accepted answer
Ok, so heres what you need to do, you will need their right leg's position. I noticed that there was a big error in your script, hit is the part that touched the part; lets say that the left leg touched the part, hit:WaitForChild("Humanoid") would mean LeftLeg:WaitForChild("Humanoid") there will be no humanoid within someone's left leg. The solution to this is to get LeftLeg's parent, which is the actual Character. Once you are at the character, you can find their humanoid.
(you might want to add a debounce to this script to keep it from running over and over again)
debounce: https://developer.roblox.com/en-us/articles/Debounce
old script:
local puddle = script.Parent
puddle.Touched:Connect(function(hit)
if hit:WaitForChild('Humanoid') then
local rightLegLatex = Instance.new('Part')
local rightLegLatexWeld = Instance.new('Weld')
rightLegLatex.Size = Vector3.new(1, 2, 1)
rightLegLatex.Parent = hit
rightLegLatex.Position
rightLegLatexWeld.Part0 = hit.RightLeg
rightLegLatexWeld.Part1 = rightLegLatex
end
end)
There was no need for a position anyways, I just added that to let you know how to add position in the future, The weld already sets the position to the leg. Anyways, heres what I did
New Script:
local puddle = script.Parent
local debounce = false
puddle.Touched:Connect(function(hit)
local humanoid = hit.Parent:FindFirstChild("Humanoid")
if humanoid ~= nil and debounce == false then
local findExistingLatex = hit.Parent:FindFirstChild("RightLegLatex", true)
debounce = true
if findExistingLatex == nil then
local rightLegLatex = Instance.new("Part")
local rightLegLatexWeld = Instance.new("Weld")
local rightLeg = hit.Parent:FindFirstChild("Right Leg")
rightLegLatex.Name = "RightLegLatex"
rightLegLatex.Size = Vector3.new(1, 2, 1)
rightLegLatex.Parent = hit
rightLegLatex.Position = rightLeg.Position
rightLegLatexWeld.Part0 = rightLeg
rightLegLatexWeld.Part1 = rightLegLatex
rightLegLatexWeld.Parent = rightLegLatex
wait(1)
debounce = false
end
end
end)
I really hope this is not that confusing ^-^
1 comment
I may be wrong but i think that if you'll put rightLegLatex.Position = Vector3.new(hit.Parent.RightLeg.Position) -- you can change RightLeg to LeftLeg And also im not sure if it will work but im just saying that this may help ;)