[SOLVED] Help with the CFrame

  1. i just got error and could not fix it

here script:

EventsFolder.gloryKillPos.OnServerEvent:Connect(function(plr,Target)
	local char = plr.Character or plr.CharacterAdded:Wait()
	local hrpChar = char:WaitForChild("HumanoidRootPart")
	local hrpTarget = Target:WaitForChild("HumanoidRootPart")
	local targethum = Target:WaitForChild("Humanoid")
	Target:WaitForChild("Humanoid").WalkSpeed = 0
	local gkVictim = Target:WaitForChild("Humanoid"):LoadAnimation(Tool:WaitForChild("AnimsFolder"):WaitForChild("GkVictim"))
	gkVictim:Play()
	
	hrpTarget.Anchored = true
	hrpChar.Anchored = true
	hrpTarget.CFrame = hrpChar.CFrame.lookVector * CFrame.new(0,0,-2)
	
	wait(0.9)
	Tool:WaitForChild("FistPoints").Hit1:Play()
	targethum:TakeDamage(5)
	wait(0.18)
	Tool:WaitForChild("FistPoints").Hit2:Play()
	targethum:TakeDamage(5)
	wait(0.33)
	hrpChar.Anchored = false
	Tool:WaitForChild("FistPoints").Hit3:Play()
	targethum:TakeDamage(targethum.MaxHealth)
end)

what error i got:

Players.voicesinmyming.Backpack.Fists.Server:520: invalid argument #1 (CFrame expected, got Vector3)

where error located:

hrpTarget.CFrame = hrpChar.CFrame.lookVector * CFrame.new(0,0,-2)

Can you try

hrpTarget.CFrame = hrpChar.CFrame.lookVector * Vector3.new(0,0,-2)

Unable to assign property CFrame. CoordinateFrame expected, got Vector3 -

Perhaps you meant to add?

hrpTarget.CFrame = hrpChar.CFrame.lookVector + CFrame.new(0,0,-2)

Or convert a Vector3 into a CFrame?

hrpTarget.CFrame = CFrame.new(hrpChar.CFrame.lookVector * Vector3.new(0,0,-2))
1 Like

this works

but its looking like this now

Do this instead

--moves the target humanoidrootpart 2 studs in front of the character’s hrp
hrpTarget.CFrame = hrpChar.CFrame:PointToWorldSpace(Vector3.new(0, 0, -2))

you might also want to do something with the humanoidrootpart or the humanoid so that the character doesn’t get flung.

1 Like

it not works it says same error

Change to:

hrpTarget.CFrame = hrpChar.CFrame + (hrpChar.LookVector * 2)
2 Likes

LookVector is not a valid member of Part “Workspace.chars.TbeyazT.HumanoidRootPart”

Yes, a simple typo. Have you tried fixing it yourself? You should know that LookVector is a property of CFrames. What do you think I was trying to do? :thinking:

hrpTarget.CFrame = hrpChar.CFrame + (hrpChar.CFrame.LookVector * 2)

try this

hrpTarget.CFrame = CFrame.new(0,0,0,hrpChar.CFrame.lookVector.LookVector.X,hrpChar.CFrame.lookVector.Y,hrpChar.CFrame.lookVector.LookVector.Z * -2)

Instead of

hrpTarget.CFrame = hrpChar.CFrame.lookVector * CFrame.new(0,0,-2)

Try this :stuck_out_tongue:

hrpTargetCFrame = hrpChar.CFrame + hrpChar.CFrame.LookVector * 2
1 Like

i tried everymethod i know but not worked

BROOO THANK YOU SO MUCH i am soo bad how did i not see this

I sent you that exact code already.
What makes his better? Did you not understand mine, but understood his? I would ask if you saw it, but you did.

It’s the same, but mine was 3 hours before. :+1:
I predicted this would happen, it’s just how the devforum is.

i am sorry about that my guy ok i fixing it

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.