Hello everyone .... I speak Spanish, it is my first topic, I hope I do not make mistakes, if so, let me know ... thank you.
What I want is to move an object from one point to another, and I got a simple script for that.
local ROOT = script.parent
local Time = script:GetCustomProperty("Time") -- I have created a Float
local Pos1 = script:GetCustomProperty("Pos1") -- I have created a Vector 3
local Rot = script:GetCustomProperty("Rot") -- I have created a Rotation
local RotMulti = script:GetCustomProperty("RotMulti") -- I have created a Float
if (RotMulti > 0) then
ROOT:RotateContinuous(Rot, RotMulti)
end
local DELAY = script:GetCustomProperty("Delay") -- I have created a Float
local movementProgress = 0
local delayProgress = 0
local movingToOffset = true
local startPos = ROOT:GetWorldPosition()
function Tick(dt)
ROOT:MoveTo(startPos + Pos1, Time)
Task.Wait(Time + DELAY)
ROOT:MoveTo(startPos, Time)
Task.Wait(Time + DELAY)
end
With this everything works wonderfully. The problem is when I want to add another move point.
I would like from the startPos to go Pos1 - Pos2 - Pos1 - startPos
I tried:
local ROOT = script.parent
local Time = script:GetCustomProperty("Time") -- I have created a Float
local Pos1 = script:GetCustomProperty("Pos1") -- I have created a Vector 3
local Pos2 = script:GetCustomProperty("Pos2") -- ( ADDED ) a Vector 3
local Rot = script:GetCustomProperty("Rot") -- I have created a Rotation
local RotMulti = script:GetCustomProperty("RotMulti") -- I have created a Float
if (RotMulti > 0) then
ROOT:RotateContinuous(Rot, RotMulti)
end
local DELAY = script:GetCustomProperty("Delay") -- I have created a Float
local movementProgress = 0
local delayProgress = 0
local movingToOffset = true
local startPos = ROOT:GetWorldPosition()
function Tick(dt)
ROOT:MoveTo(startPos + Pos1, Time)
Task.Wait(Time + DELAY)
ROOT:MoveTo(startPos + Pos1 + Pos2, Time) -- (ADDED)
Task.Wait(Time + DELAY)
ROOT:MoveTo(startPos + Pos1, Time) -- (ADDED)
Task.Wait(Time + DELAY)
ROOT:MoveTo(startPos, Time)
Task.Wait(Time + DELAY)
end
The movements are made but the same error always comes out:
Function called with incorrect number or type of parameters. Check your parameters for any unexpected nil values or values that are not the type you expect them to be.
I have also tried:
ROOT:MoveTo(Pos1 + Pos2, Time)
ROOT:MoveTo(Pos2, Time)
I always get an error on the same line, second movement.
From already thank you very much and I hope some help !!