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
 

How would I change a tools usage distance?

Previous Thread :: Next Thread 
all_Dev is not online. all_Dev
Joined: 16 Dec 2011
Total Posts: 1854
19 Jan 2017 09:10 PM
I do plan on adding my own stuff later, in the meantime I need to use them for testing.

http://www.roblox.com/Westworld-item?id=525246965
Report Abuse
crome60 is not online. crome60
Joined: 22 Nov 2008
Total Posts: 15266
19 Jan 2017 09:21 PM
local torso = p.Character.Torso

Literally just define the torso.
Report Abuse
antonio6643 is online. antonio6643
Joined: 30 Aug 2009
Total Posts: 791
19 Jan 2017 09:21 PM
Instead of telling you to "do it on your own", I'm gonna do it, and then explain what I did(While staying true to your style of scripting).

function onClicked(mouse)
if on then
p = game.Players.LocalPlayer

if (p == nil) then return end
if (p.Character == nil) then return end

if (mouse.hit.p - Torso.cframe.p).magnitude < 20 then

Now something I'd rather do would be:

function onClicked(mouse)
if on then
p = game:GetService("Players").LocalPlayer --There has to be a localplayer if this is in a localscript.


if not p.Character then return end --Just incase there's a script that removes the character
if (mouse.hit.p - Torso.cframe.p).magnitude < 20 then --Remember that Torso is capitalized, and scripting is case-sensitive.

If you have anymore questions, feel free to ask.




I'm Batman
Report Abuse
antonio6643 is online. antonio6643
Joined: 30 Aug 2009
Total Posts: 791
19 Jan 2017 09:22 PM
One more thing: Capitalize CFrame.


I'm Batman
Report Abuse
LuluPls is not online. LuluPls
Joined: 23 Aug 2010
Total Posts: 1221
19 Jan 2017 09:24 PM
You can't call yourself a developer when you use things that others make and put them together, and as you say "earn money" off their hard work. As for your second argument, I did not help because all you have to do is:

1. Go to google
2. write "attempt to index a nil value roblox"
3. Click on one of the various links that show up
4. Yay, now you know what the error means and how to fix it, now you don't have to go on forums and waste everyone's time!


R$0
Report Abuse
all_Dev is not online. all_Dev
Joined: 16 Dec 2011
Total Posts: 1854
19 Jan 2017 09:29 PM
Thanks for helping out @antonio and @crome! I figured it out already, thanks to a friend.

http://www.roblox.com/Westworld-item?id=525246965
Report Abuse
Previous Thread :: Next Thread 
Page 2 of 2Go to page: 1, [2] Prev
 
 
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