generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Help please!

Previous Thread :: Next Thread 
RichardRAHI is not online. RichardRAHI
Joined: 02 Sep 2012
Total Posts: 1096
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
RichardRAHI is not online. RichardRAHI
Joined: 02 Sep 2012
Total Posts: 1096
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
RichardRAHI is not online. RichardRAHI
Joined: 02 Sep 2012
Total Posts: 1096
14 Dec 2014 09:07 PM
b1
Report Abuse
RA2lover is not online. RA2lover
Joined: 09 Nov 2008
Total Posts: 1254
14 Dec 2014 09:24 PM
You're reparenting the wrong instance.
Report Abuse
RichardRAHI is not online. RichardRAHI
Joined: 02 Sep 2012
Total Posts: 1096
14 Dec 2014 09:34 PM
?
Report Abuse
RA2lover is not online. 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
RichardRAHI is not online. RichardRAHI
Joined: 02 Sep 2012
Total Posts: 1096
14 Dec 2014 10:27 PM
How else could I do it?
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image