Dear_J Posted June 2, 2017 Share Posted June 2, 2017 Hi! I am currently making an item that spawn effect (in this case a prefab) on the item's owner when equipped and gone when unequipped. I understand how the equip and unequip works, What i want to ask is, how to make a prefab spawn and "attach" on another prefab? So, when the "attached" prefab is moving, the "attaching" prefab is moving too. A simple example is like aura thing (see attached image). Link to comment Share on other sites More sharing options...
. . . Posted June 2, 2017 Share Posted June 2, 2017 I'm guessing you would insert this code into whatever/whenever your character's wants his prefab attached Spoiler local fx = SpawnPrefab("YOUR PREFAB NAME HERE") if fx ~= nil then fx.entity:SetParent(inst.entity) fx:DoTaskInTime(10, function() fx:Remove() end) -- Incase you'd want it go be removed after a certain amount of time, i Htink this'll work. end hopefully, yhis works for you ! Link to comment Share on other sites More sharing options...
Dear_J Posted June 4, 2017 Author Share Posted June 4, 2017 @SuperDavid Ah, i see, there is such parent structure. I'll try it out, and let you know! Link to comment Share on other sites More sharing options...
Dear_J Posted June 4, 2017 Author Share Posted June 4, 2017 (edited) @SuperDavid Your code works but the prefab didn't appear correctly, i did some search on related topics and found your topics. Quote I think this fixed my problem, hopefully. So, hopefully no more help needed on this . local fx = SpawnPrefab("spawn_fx_medium") if fx ~= nil then fx.entity:SetParent(act.target.entity) fx.entity:AddFollower() fx.Follower:FollowSymbol(act.target.GUID, "torso", 0, 0, 0) end And i added it up with some changes, it works now! Thanks! Edited June 4, 2017 by Dear_J Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now