Jump to content

Spawning objects using a Child() pivot


roysizon
 Share

Recommended Posts

I made a pivot with a spawning object script, it works but I want the pivot to be a child to the player so that whenever the player moves the object spawns around him. I tried to do so but it didnt work.

 

Here is the spawning script. It spawns only 3 object, each object every 15 second.

 

Script.object = "" --Entity "Spawn Object"

 

local lasttime = 0

local object1 = 3

 

function Script:UpdateWorld()

 

if Time:GetCurrent()-15000>lasttime and object1 >0 then

lasttime=Time:GetCurrent()

local newobject = self.object:Instance()

newobject:SetPosition(self.entity:GetPosition())

object1 = object1 -1

 

end

Link to comment
Share on other sites

I made a pivot with a spawning object script, it works but I want the pivot to be a child to the player so that whenever the player moves the object spawns around him. I tried to do so but it didnt work.

 

Here is the spawning script. It spawns only 3 object, each object every 15 second.

 

Script.object = "" --Entity "Spawn Object"

 

local lasttime = 0

local object1 = 3

 

function Script:UpdateWorld()

 

if Time:GetCurrent()-15000>lasttime and object1 >0 then

lasttime=Time:GetCurrent()

local newobject = self.object:Instance()

newobject:SetPosition(self.entity:GetPosition())

object1 = object1 -1

 

end

 

In what way did it not work?

 

What happens when you change:

newobject:SetPosition(self.entity:GetPosition())

to:

newobject:SetPosition(self.entity:GetPosition(true), true)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...