|
| 14 Dec 2014 09:02 PM |
So this is the script im useing to pick up an item and place it in Backpack by pressing "E" while the mouse is over the item.
local player=game.Players.LocalPlayer local mouse=player:GetMouse() local cas=game:GetService("ContextActionService")
function PickUpItem if UserInputState==Enum.UserInputState.KeyDown then if mouse.Target.Name==("Handle") then mouse.Target.Parent=player.Backpack end end end
cas:BindActionToInputTypes("PickUp",PickUpItem,false,Enum.KeyCode.E)
Now, When I plress "E" and its over the item I get this in the Output window: " ContextActionService::InvokeCallback failed because Script that implemented this callback has been destroyed"
If I touch and pick up the item it gives me this: " ContextActionService:BindFunctionToInputTypes already has actionName. Overwriting this actionName."
What do those mean and how can I fix it?
|
|
|
| Report Abuse |
|
|
|
| 14 Dec 2014 09:03 PM |
Oops the script is actually:
local player=game.Players.LocalPlayer local mouse=player:GetMouse() local cas=game:GetService("ContextActionService")
function PickUpItem(a,b,io) if io.UserInputState==Enum.UserInputState.KeyDown then if mouse.Target.Name==("Handle") then mouse.Target.Parent=player.Backpack end end end
cas:BindActionToInputTypes("PickUp",PickUpItem,false,Enum.KeyCode.E)
|
|
|
| Report Abuse |
|
|
| |
|
RA2lover
|
  |
| Joined: 09 Nov 2008 |
| Total Posts: 1254 |
|
|
| 14 Dec 2014 09:24 PM |
| You're reparenting the wrong instance. |
|
|
| Report Abuse |
|
|
| |
|
RA2lover
|
  |
| Joined: 09 Nov 2008 |
| Total Posts: 1254 |
|
|
| 14 Dec 2014 09:51 PM |
You're moving a basepart to the backpack.
Either way, the detection method used itself is failure-prone. |
|
|
| Report Abuse |
|
|
| |
|