set location||doc135435

September 20, 2022

Format

 Object:setPosition(pos) 
  • The class to which the function belongs:Object

Description

Set the location coordinates.


Precautions

  • By setting the location by this method, the location of the server and the client will not be synchronized, that is, if the location is set on the server, the client cannot see the effect.

Parameters

Variable name type Description
pos Vector3 Position coordinates


Code Samples

on the client side of the objectmount script, set it to the position point whose coordinates are (1,1,1)

local pos = Vector3.new(1, 1, 1)       --Create a new vector3
World.Timer(60,function()              --Start the timer and set the object position after 3 seconds
    this:setPosition(pos)              --Set object position
end)