|
| 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
|
  |
| 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 |
|
|
|
| 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
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 08 Nov 2016 08:24 PM |
| ##################################################################################### |
|
|
| Report Abuse |
|
|