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: RemoteEvent is not a valid member of tool.

Previous Thread :: Next Thread 
batninja12 is online. batninja12
Joined: 09 Apr 2011
Total Posts: 99
08 Nov 2016 07:00 PM
Apologies for the last hashtag abomination. Anyways, I was talking about how I am a huge noob when it comes to scripting and I was having troubles with one particular script. A script I was learning from wiki.roblox about tools, I had followed and copied every step, but when I went to the real game it kept saying, "ClickEvent is not a valid member of Tool.".

Here is the script:

-- Local Script
local tool = script.Parent
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local clickEvent = tool.ClickEvent

local function onActivate()
local clickLocation = mouse.Hit
clickEvent:FireServer(clickLocation)
end

tool.Activated:connect(onActivate)

The link to the wiki I was reading:
(Remove the super obvious brackets.)
wiki.roblox.(REMOVE THIS THING)com/index.p(HELP A SCRIPT NOOB)hp?title=Tools


im kool
Report Abuse
Salinas23 is not online. Salinas23
Joined: 28 Dec 2008
Total Posts: 37141
08 Nov 2016 07:02 PM
Inside your tool there should be a RemoteEvent called "ClickEvent"

I have a spider on my back.
Report Abuse
lua_pointer is not online. lua_pointer
Joined: 15 Oct 2016
Total Posts: 179
08 Nov 2016 07:04 PM
You need to wait for it to exist
local clickEvent = tool:WaitForChild'ClickEvent'

Also, use GetService :)

game:GetService("Players") is much hotter

And do not define variables you only use once, and use semi-colons to define the end of a statement. It can prevent ambiguous syntax.
That said,

local tool = script.Parent;
local clickEvent = tool:WaitForChild("ClickEvent");
local mouse = game:GetService("Players").LocalPlayer:GetMouse();

tool.Activated:connect(function()
clickEvent:FireServer(mouse.Hit);
end);
Report Abuse
TimeTicks is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
08 Nov 2016 08:24 PM
#####################################################################################
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