Jump to content

Recommended Posts

local function giveBrokenItem(inst)	local player = inst:GetNearestPlayer(true)	local loot = SpawnPrefab("broken_item")	player.components.inventory:GiveItem(loot)endinst.components.finiteuses:SetOnFinished(giveBrokenItem)

 

Hey! Thank you :grin: but now the item doesn't remove now. 

post-273342-0-09127500-1447728735_thumb.

Edited by Neutral_Steve

Right, forgot to remove it

local function giveBrokenItem(inst)	local loot = SpawnPrefab("broken_item")	inst.components.inventoryitem.owner.components.inventory:GiveItem(loot)	inst:Remove()endinst.components.finiteuses:SetOnFinished(giveBrokenItem)

You can also get the player via the inventoryitem owner reference.

Right, forgot to remove it

local function giveBrokenItem(inst)	local loot = SpawnPrefab("broken_item")	inst.components.inventoryitem.owner.components.inventory:GiveItem(loot)	inst:Remove()endinst.components.finiteuses:SetOnFinished(giveBrokenItem)

You can also get the player via the inventoryitem owner reference.

Yay! Thank you!

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...