Hello! I am currently working on a boomerang tool. I haven't gotten too far but I have an idea of where it is going. So basically when the player clicks the boomerang will use a BodyPosition to go away from the player. But I am stuck; I want the tool to be "dropped". Or basically removed form the player's inventory but not completely removed, Just placed into the workspace. I don't know how I can do this though.
Tool = script.Parent function onActivated() Tool.Handle.BodyPosition.Position = Tool.Parent.Parent.Torso + Vector3.new (20,0,0) --This is where I want the tool to be taken out of the players inventory and placed into the workspace but I don't know how. end
Thanks! ~Minikitkat
Just do this:
Tool = script.Parent function onActivated() wait() Tool.Handle.BodyPosition.position = Tool.Parent.Torso.Position + Vector3.new (20,0,0) Tool.Parent=game.Workspace end Tool.Equipped:connect(onActivated) --Connects the function
This will remove it from the player, and place it in the Workspace, and in effect, it will be dropped. If you have any questions or problems, please leave a comment below. Hope I helped :P
More efficient function use:
Tool = script.Parent Tool.Equipped:connect(function() --Same thing as the other, just simpler, and harder to forget. wait() Tool.Handle.BodyPosition.position = Tool.Parent.Torso.Position + Vector3.new (20,0,0) Tool.Parent=game.Workspace end) --You NEED this closing parenthesis to close the function at the end if you use this method.
Just an example. I suggest you start practicing this way, it's a better way of calling and connecting functions :P