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?
You're passing in the position as the first argument:
_G.TweenPosition(Workspace.Part.Position,Workspace.Part1.CFrame,1)
But your _G.TweenPosition function takes a part as the first argument.
_G.TweenPosition = function(part, goal, t) ...
You should be passing in a part like this.
_G.TweenPosition(Workspace.Part,Workspace.Part1.CFrame,1)