So I found this script that has global functions in it and I decided to try it out in the output but I got an error saying:
Position is not a valid member
20:44:29.329 - Script 'Workspace.PartTweening', Line 2 - field TweenPosition
20:44:29.329 - Script '_G.TweenPosition(Workspace.Part.Position,Workspace.Part1.CF', Line 1
20:44:29.330 - Stack End
Script with global tables:
_G.TweenPosition = function(part, goal, t)
local start = part.Position
local increment = wait() / t
local x, y, z = part.CFrame:toEulerAnglesXYZ()
for i = increment, 1, increment do
wait()
part.CFrame = (CFrame.new(goal,i) + start:Lerp(goal, i)) * CFrame.Angles(x, y, z)
end
part.CFrame = (CFrame.new() + goal) * CFrame.Angles(x, y, z)
end
_G.TweenAngles = function(part, goal, t)
local start = Vector3.new(part.CFrame:toEulerAnglesXYZ())
local increment = wait() / t
for i = increment, 1, increment do
wait()
local lerped = start:Lerp(goal, i)
part.CFrame = CFrame.new(part.Position) * CFrame.Angles(lerped.X, lerped.Y, lerped.Z)
end
end
_G.TweenPositionAndAngles = function(part, goalP, goalA, t)
local startP = part.Position
local startA = Vector3.new(part.CFrame:toEulerAnglesXYZ())
local increment = wait() / t
for i = increment, 1, increment do
wait()
local lerped = startA:Lerp(goalA, i)
part.CFrame = (CFrame.new() + startP:Lerp(goalP, i)) * CFrame.Angles(lerped.X, lerped.Y, lerped.Z)
end
part.CFrame = (CFrame.new() + goalP) * CFrame.Angles(goalA.X, goalA.Y, goalA.Z)
end
--Blockoo
What I put in the output:
_G.TweenPosition(Workspace.Part.Position,Workspace.Part1.CFrame,1)
How would I fix this error in the script it out in the output?

10 comments
I got another error when I changed it: Workspace.Script:7: bad argument #1 to 'new' (Vector3 expected, got userdata)
There's no CFrame constructor that takes a CFrame as the first argument, according to the wiki. The problem is here: CFrame.new(goal,i)
So it's not me,it's the script?
Do you have an example of how the TweenPosition method is supposed to be used? I think the _G.TweenPosition method you're using expects you to pass in a Vector3 position for the second argument instead of a CFrame.
No I don't have an example
Ok I fixed it by changing it to a vector3 value like you said:_G.TweenPosition(Workspace.Part,Workspace.Part1.Position,CFrame,1)
But I got another error the "t" argument: Workspace.Script:3: attempt to perform arithmetic on local 't' (a table value)
"t" is suppose to a number right?
Yeah.
I'll use another script since I couldn't fix that eror,thanks for the help