#Custom NPC cloning issue
1 messages · Page 1 of 1 (latest)
here is a video
Here is the Split Function
local function Split()
local SplitType = TargetNode.Value:WaitForChild("SplitType").Value
local Node = Ronald.TargetNode.Value
local CloneNextTarget = Ronald.Parent.Nodes:WaitForChild(tostring(Node:WaitForChild("NextNode2").Value))
if SplitType == 1 then
Ronald.HumanoidRootPart.Anchored = true
print("Spliting Left Right")
SquarePreSplit:Play()
wait(SquarePreSplit.Length)
local Clone = Ronald:Clone()
Clone.HumanoidRootPart.Anchored = true
Clone:PivotTo(Ronald:GetPivot())
Clone.Parent = Ronald.Parent
Clone:WaitForChild("AI").Enabled = false
local CAnimator = Clone:WaitForChild("Humanoid"):WaitForChild("Animator")
local CAnimation = Clone:WaitForChild("Humanoid"):WaitForChild("SquareSplitRight")
CAnimator:LoadAnimation(CAnimation):Play()
SquareSplitLeft:Play()
wait(SquareSplitLeft.Length)
Clone.HumanoidRootPart.Anchored = false
Ronald.HumanoidRootPart.Anchored = false
Clone:WaitForChild("TargetNode").Value = CloneNextTarget
Clone:WaitForChild("AI").Enabled = true
elseif SplitType == 2 then
SquarePreSplit:Play()
wait(SquarePreSplit.Length)
SquareIdel:Play()
local Clone = Ronald:Clone()
Clone.HumanoidRootPart.Anchored = true
Clone:PivotTo(Ronald:GetPivot())
Clone.Parent = Ronald.Parent
Clone:WaitForChild("AI").Enabled = false
wait(0.01)
Clone.HumanoidRootPart.Anchored = false
local CAnimator = Clone:WaitForChild("Humanoid"):WaitForChild("Animator")
local CAnimation = Clone:WaitForChild("Humanoid"):WaitForChild("SquareSplitRight")
CAnimator:LoadAnimation(CAnimation):Play()
wait(SquareSplitLeft.Length)
Clone:WaitForChild("TargetNode").Value = CloneNextTarget
elseif SplitType == 3 then
SquarePreSplit:Play()
wait(SquarePreSplit.Length)
SquareIdel:Play()
local Clone = Ronald:Clone()
Clone.HumanoidRootPart.Anchored = true
Clone:PivotTo(Ronald:GetPivot())
Clone.Parent = Ronald.Parent
Clone:WaitForChild("AI").Enabled = false
wait(0.01)
Clone.HumanoidRootPart.Anchored = false
local CAnimator = Clone:WaitForChild("Humanoid"):WaitForChild("Animator")
local CAnimation = Clone:WaitForChild("Humanoid"):WaitForChild("SquareSplitLeft")
CAnimator:LoadAnimation(CAnimation):Play()
wait(SquareSplitLeft.Length)
Clone:WaitForChild("TargetNode").Value = CloneNextTarget
end
end
and the move function
local function MoveToNode()
SquareIdel:Stop()
SquareMove:Play()
local Node = Ronald.TargetNode.Value
local Distance = 100
while Distance > 7.5 do
Distance = math.abs((Node.Position - Ronald.HumanoidRootPart.Position).Magnitude)
print("Distance: " .. tostring(Distance))
Hum:MoveTo(Node.Position)
Hum.MoveToFinished:Wait()
end
print("Got To Node")
end
can someone please help?
** You are now Level 1! **
Your script looks fine to me. Maybe its a collision issue? Try making a collision group for ronald and make the collision group not collide with itself.
I made a collision group for Ronald's humanoid root part that won't collide with others, and gave him a custom collision group part as a floor in case he was colliding with the map
he wont collide with anything but this one part
Maybe set every part in ronalds body to ronalds collision group
just incase if his arms collide with the arms of another ronald maybe
they currently are set to not collide but i can try
I figured out that they are upside down since i forgot to enable their AI after spliting on certain intersections
I still need to stop them from phasing throught the floor
I have isolated my issue to the fact that the hip height is not used for the first 5 seconds after the clone spawns causing the humanoid root part to fall to the ground making the npoc phase throught the ground