Jump to content

Can't get Script to work

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


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




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

Share this post

Link to post

Solved. Thank you :D It had a Mass of 0.0, thank you for making me check that. It's always something so simple that gets me.

Share this post

Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

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.

  • Create New...