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: tools is not a valid member of Workspace

Previous Thread :: Next Thread 
Reziztor is online. Reziztor
Joined: 08 Jul 2014
Total Posts: 67
29 Apr 2017 04:33 PM
So I made this script where whenever a player clicks a brick, a knife would be awarded to that player. However, it's saying that the model that stores all of the tools doesn't exist, even though it's right there. Any idea why this isn't working? Here's the script:

function onClicked(playerWhoClicked)
workspace.tools.knoife:Clone().Parent = playerWhoClicked
end

script.Parent.ClickDetector.MouseClick:connect(onClicked)


Report Abuse
GIassWindows is not online. GIassWindows
Joined: 03 Oct 2016
Total Posts: 285
29 Apr 2017 04:45 PM
playerWhoClicked.Backpack?

idk try that


ok
Report Abuse
Reziztor is online. Reziztor
Joined: 08 Jul 2014
Total Posts: 67
29 Apr 2017 04:48 PM
no, it's not playerWhoClicked, it's the fact that tools is in workspace but it's saying that it's not in workspace.


Report Abuse
Henderick is not online. Henderick
Joined: 10 Dec 2007
Total Posts: 1523
29 Apr 2017 04:48 PM
did you intentionally name your knife "kniof"
Report Abuse
Henderick is not online. Henderick
Joined: 10 Dec 2007
Total Posts: 1523
29 Apr 2017 04:48 PM
my bad "knoife"
Report Abuse
Reziztor is online. Reziztor
Joined: 08 Jul 2014
Total Posts: 67
29 Apr 2017 04:49 PM
indeed


Report Abuse
GIassWindows is not online. GIassWindows
Joined: 03 Oct 2016
Total Posts: 285
29 Apr 2017 04:50 PM
is there a typo somewhere?


ok
Report Abuse
Reziztor is online. Reziztor
Joined: 08 Jul 2014
Total Posts: 67
29 Apr 2017 04:51 PM
no, i checked everything


Report Abuse
Dev_Cos is not online. Dev_Cos
Joined: 22 Oct 2016
Total Posts: 83
29 Apr 2017 05:11 PM
Try putting game in front of workspace maybe?
Report Abuse
Reziztor is online. Reziztor
Joined: 08 Jul 2014
Total Posts: 67
29 Apr 2017 05:13 PM
i've done that, doesn't work


Report Abuse
Soybeen is not online. Soybeen
Joined: 17 Feb 2010
Total Posts: 21462
29 Apr 2017 05:14 PM
You're parenting it to the player
parent it to the player's backpack, or their character if they don't already have a tool equipped.
Report Abuse
Dev_Cos is not online. Dev_Cos
Joined: 22 Oct 2016
Total Posts: 83
29 Apr 2017 05:16 PM
Maybe when the player is added it the tool hasnt fully loaded.


Report Abuse
Reziztor is online. Reziztor
Joined: 08 Jul 2014
Total Posts: 67
29 Apr 2017 05:23 PM
still not working? i think i'm doing something wrong, here's the script

function onClicked(playerWhoClicked)
workspace.tools.knoife:Clone().Parent = playerWhoClicked.Backpack
end

script.Parent.ClickDetector.MouseClick:connect(onClicked)


Report Abuse
Soybeen is not online. Soybeen
Joined: 17 Feb 2010
Total Posts: 21462
29 Apr 2017 08:26 PM
Just open your output and give us the error
Report Abuse
Reziztor is online. Reziztor
Joined: 08 Jul 2014
Total Posts: 67
29 Apr 2017 08:27 PM
the error is the title


Report Abuse
Soybeen is not online. Soybeen
Joined: 17 Feb 2010
Total Posts: 21462
29 Apr 2017 08:31 PM
workspace.tools doesn't exist when the script runs
Report Abuse
Reziztor is online. Reziztor
Joined: 08 Jul 2014
Total Posts: 67
29 Apr 2017 08:32 PM
it does exist. it's not called in through instance.new or anything


Report Abuse
Soybeen is not online. Soybeen
Joined: 17 Feb 2010
Total Posts: 21462
29 Apr 2017 08:35 PM
It doesn't exist, that's what your error means.
Read what I said carefully,
it doesn't exist -> when the script runs <-

Though it might exist later.
say tools = workspace:WaitForChild("tools")

And please use better variable names
Report Abuse
Reziztor is online. Reziztor
Joined: 08 Jul 2014
Total Posts: 67
29 Apr 2017 09:01 PM
turns out the real reason why it kept on erroring me is because the knife wasn't on the baseplate, unanchored, and kept falling into nonexistence

aha...ha...


kill me


Report Abuse
Soybeen is not online. Soybeen
Joined: 17 Feb 2010
Total Posts: 21462
29 Apr 2017 10:06 PM
You should put it somewhere like ReplicatedStorage
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