Jump to content

Can't get Script to work


Sokiyo
 Share

Recommended Posts

I'm trying to get Barrels to fall from a certain point every 1.5 seconds. I have the spawn point in for it and everything. When I click "Run", the barrel is in the sky where it should be falling from but it doesn't fall, and no more spawn in. How do i get it to spawn in every 1.5 seconds and fall down?

The script I have for it:

 

1.)Script.spawnObject = "" --entity "Spawn object"

2.)Script.spawnTime = 1.5 --float "Spawn time"

3.)local timer = 0

4.)

5.)function Script:UpdateWorld()

6.) timer = timer + (Time:GetSpeed()/100)

7.) if(timer > self.spawnTime) then

8.) local newObject = self.spawnObject:Instance()

9.) newObject:SetPosition(self.entity:GetPosition())

10.) timer = 0

11.) end

12.)

12.)end

 

Also, I do have the Barrel set as the spawn object for the spawning point, and the script is attached to it, as well.

 

Edit: I forgot to mention. I'm using Lua

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...