Changing a Part's CFrame to the player character's HumanoidRootPart CFrame gives the wrong position

  1. What do you want to achieve?
    I want the part CFrame of the kamehameha go to the HumanoidRootPart’s CFrame
  2. What is the issue?
    Well, when I walk/run or just move and I press the key to activate the move, the parts go in the wrong position.
  3. What solutions have you tried so far?
    First of all, the HumanoidRootPart is anchored. So, as a solution, since the CFrame of the parts are being set AFTER the humanoidrootpart is anchored, I tried adding one second before changing the CFrame, well it didn’t work. No clue on why it’s doing that. Other effects’ parts are wrong aswell, except when the release part is played, since I changed their position manually, even tho they should go in the right position from the start.

This is my current script (i’m just gonna send the most “useful” parts to not make everything too long and leave all my script public. If you want the full script ask me:

    rp.events.KamehaEvent.OnServerEvent:Connect(function(Player)
    local Character = Player.Character
    local Humanoid = Character:FindFirstChild("Humanoid")
    Character.HumanoidRootPart.Anchored = true
    Humanoid.WalkSpeed = 0
    Humanoid.JumpPower = 0
     --settings the parts taken from ReplicatedStorage as clones code
          Start:Play() -- plays the start animation, that I use to try and solve my "bug"
          wait(1)
local lPosition = Character.LowerTorso.Position - Vector3.new(0,1,0)
    -- effects stuff, and the charging animation (yes, they are glitched as well. the only reason it's working is because I welded the parts)
              
local lPosition = Character.LowerTorso.Position - Vector3.new(0,1,0)
          
  local In = folder:WaitForChild("In"):Clone()
  In.CFrame = Character:WaitForChild("LeftHand").CFrame
  In.Size = Vector3.new(1.5,1.5,1.5)
  In.Parent = Folder
    		
local inWeld = Instance.new("ManualWeld")
inWeld.Part0 = In
inWeld.Part1 = Character:WaitForChild("LeftHand")
inWeld.C0 = In.CFrame:inverse() *  Character:WaitForChild("LeftHand").CFrame
inWeld.Parent = In
    		
local Out= folder:WaitForChild("Out"):Clone()
Out.CFrame = In.CFrame
Out.Size = Vector3.new(2,2,2)
Out.Parent = Folder
    		
local outWeld = Instance.new("ManualWeld")
outWeld.Part0 = Out
outWeld.Part1 = In
outWeld.C0 = Out.CFrame:inverse() * In.CFrame
outWeld.Parent = Out

wait(2)
  --Now for when the release animation and stuff plays. You can see what it does in the picture I sent

shock.Parent = game.Workspace
shock.Position = lPosition
local shockinfo = TweenInfo.new(1.25, Enum.EasingStyle.Quint, Enum.EasingDirection.Out, 0, false ,0)
local shockgoals = {Size = Vector3.new(40,4,40), Transparency = 1}
local shocktween = TweenService:Create(shock,shockinfo,shockgoals)
	
local Inner2 = Meshes:WaitForChild("Inner"):Clone()
Inner2.CFrame = Character:WaitForChild("HumanoidRootPart").CFrame
Inner2.Size = Vector3.new(3,3,3)
Inner2.Anchored = true
Inner2.Parent = Folder
		
local Outter2 = Meshes:WaitForChild("Outter"):Clone()
Outter2.CFrame = Inner2.CFrame
Outter2.Size = Vector3.new(4.5,4.5,4.5)
Outter2.Anchored = true
Outter2.Parent = Folder
	
reversering.Parent = game.Workspace
reversering.Position = lPosition
local reverseinfo = TweenInfo.new(1, Enum.EasingStyle.Quint, Enum.EasingDirection.Out, 0, false ,0)
local reversegoals = {Size = Vector3.new(30,0.5,30),Transparency = 1}
local reversetween = TweenService:Create(reversering,reverseinfo,reversegoals)

--everything else (sounds, effects, etc...)
wait(3.5)
Dust1.Enabled = false
Dust2.Enabled = false
Dust3.Enabled = false
gui.Visible = false
shock:Destroy()
reversering:Destroy()
for i, v in pairs(Folder:GetChildren()) do
	local goal = {}
	goal.Transparency = v.Transparency + (1 - v.Transparency)
	local info = TweenInfo.new(1)
	local tween = TweenService:Create(v,info,goal)
	tween:Play()
end
Debris:AddItem(Folder,2)
bv:Remove() -- if you are wondering what this is, it's the BodyVelocity that makes the enemy move, I doubt it's a problem since it doesn't affect in any way the parts of the kame
wait(2)
PartDust1:Destroy()
PartDust2:Destroy()
PartDust3:Destroy()
Character.HumanoidRootPart.Anchored = false
Humanoid.WalkSpeed = 16
Humanoid.JumpPower = 50
    end)

Any help is appreciated. I hate having to keep asking other people for help, but when something doesn’t work and I can’t find anything related to it, I have to. If you really need the full script, I will send it to you in DMs if possible, since I don’t really want other people to copy it. Thxx

Does it work if it’s unanchored?

This happened to me sometimes when the player is anchored. I think the reason is you’re anchoring the character and you see the character at a different frozen position than the server.

2 Likes

Omg it works perfectly now! Thank you a lot! I’ll keep in mind next time I think of anchoring something. :slight_smile: