I've read other stuff similar to my question, none really helped me though
local TS = game:GetService("TweenService") local Plr = game:GetService("Players").LocalPlayer local HRP = Plr.Character.HumanoidRootPart if success() then for _, v in pairs(workspace:GetChildren()) do for _, c in pairs(v:GetChildren()) do if c:IsA("Tool") then TS:Create(HRP, TweenInfo.new(1), {CFrame = CFrame.new(c:FindFirstChild("Handle").CFrame)}) task.wait(0.5) tween:Play() end end end end
I'm trying to make it so every time the success
function is called, it tweens the player to the handle, it errors on line 9 which is, TS:Create(HRP, TweenInfo.new(1), {CFrame = CFrame.new(c:FindFirstChild("Handle").CFrame)})
, I'm not doing teleportation because of the anti cheat detecting teleportation.
Problem
You are trying to create a CFrame from a CFrame value.
Description
There is not a constructor that creates a CFrame value from a CFrame value, thus your error. A list of constructors can be found on the CFrame's Roblox API page.
To create a basic CFrame from a Vector position, you can use this:
local ThisIsACFrame = CFrame.new(Vector3.new(0, 0, 0)) -- Creates a CFrame at position 0,0,0
The error was given because Roblox assumed you were trying to use the constructor from the code above but found a CFrame instead of a Vector3 value.
Solution
You could create a new CFrame, but in this case it is not necessary. Instead, since you already have a desired CFrame, you could simply set the Tween's goal to:
Code
TS:Create(HRP, TweenInfo.new(1), {CFrame = c:FindFirstChild("Handle").CFrame})
If you have any questions or feel that any part of this answer was unclear, feel free to contact me via Discord
(phxntxsmic#2021)
{CFrame = CFrame.new(c:FindFirstChild("Handle").CFrame.p)}