I wanted to make an object that moves to waypoints,but it clips into the ground so i wanted to make it only change its X and Z coordinates,but for some reason TweenService just doesnt count this as a property or something?.
The error is “Workspace.Sweep.Hitbox.Script:14: attempt to index nil with ‘X’”
Heres the script
local Sweep = script.Parent
local TweenService = game:GetService("TweenService")
local Info = TweenInfo.new(3)
local SweepWaypoints = workspace.Waypoints.Sweep
local SweepWaypointTable = {}
SweepWaypointTable = SweepWaypoints:GetChildren()
print(SweepWaypointTable[math.random(1,#SweepWaypoints:GetChildren())])
local goals1 = {}
goals1.Position.X = SweepWaypointTable[math.random(1,#SweepWaypoints:GetChildren())].Position.X -- Here
goals1.Position.Z = SweepWaypointTable[math.random(1,#SweepWaypoints:GetChildren())].Position.Z
local function woohowtghoarytg()
local Tween1 = TweenService:Create(Sweep,Info,{Position = SweepWaypointTable[math.random(1,#SweepWaypoints:GetChildren())].Position})
Tween1:Play()
Tween1.Completed:Wait()
woohowtghoarytg()
end
woohowtghoarytg()
How can i fix it?
Thanks in advance.