StarJ3M
(StarJ3M)
October 20, 2022, 2:07am
#1
I’m trying to set this CFrame of a part and add some offset, but it doesn’t seem to be working.
How do I fix this?
while task.wait() do
workspace.Part.CFrame = script.Parent:WaitForChild("HumanoidRootPart").CFrame + CFrame.new(Vector3.new(0, 0, 2))
end
Workspace.NubblyFry.LocalScript:2: invalid argument #2 (Vector3 expected, got CFrame) - Client - LocalScript:2
DasKairo
(Cairo)
October 20, 2022, 2:09am
#2
try this?
while task.wait() do
workspace.Part.Position = script.Parent:WaitForChild("HumanoidRootPart").Position + Vector3.new(0, 0, 2)
end
Should work
StarJ3M
(StarJ3M)
October 20, 2022, 2:16am
#3
Could you explain what you changed?
DasKairo
(Cairo)
October 20, 2022, 2:18am
#4
while task.wait() do
workspace.Part.Position -- Part Position
= script.Parent:WaitForChild("HumanoidRootPart").Position -- Send the part to the hrp
+ Vector3.new(0, 0, 2) -- adds the Offset to the position
end
StarJ3M
(StarJ3M)
October 20, 2022, 2:22am
#5
My point is, can you explain how you solved the error and how you corrected it to make it work
ps: it worked
DasKairo
(Cairo)
October 20, 2022, 2:23am
#6
The problem was that you are trying to use a Vector3 inside a CFrame, the Script was looking for a CFrame, not a Vector3
This script should only look for the vector3 instead of a CFrame
1 Like