Jump to content

Random Spawn at World Generation


Recommended Posts

function SpawnItem(player)

 

--Spawn the item at the world origin.

local item = GLOBAL.SpawnPrefab("Your Prefab")

 

--Move the item to the player's position.

item.Transform:SetPosition(player.Transform:GetWorldPosition())

 

end

 

AddSimPostInit(SpawnItem)

 

This will spawn it everytime you enter the game though so I need to find a way to only spawn it once.

 

I did look in the eye bone.

It use the GetSpawnPoint function which need what Vector3 function return though I don't know what it return , I don't know where the definition is. In the eye bone file, it use inst.Transform:GetWorldPosition() but when I replace it with player.Transform:GetWorldPosition() I get "attempt to call 'Vector3' (a nil value)"

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

×
  • Create New...