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 » Scripting Helpers
Home Search
 

Re: Can I use variables for locating items?

Previous Thread :: Next Thread 
Sasuto10 is not online. Sasuto10
Joined: 05 May 2010
Total Posts: 183
28 Feb 2012 10:16 PM
very simple script for im not a big scripter:

name = "Sasuto10" --Name Here

afk = Instance.new("Hint", game.Workspace)
afk.Text = name.. " is afk..."

ff = Instance.new("Force Feild", game.Workspace

of course, its not finished because i haven't gotten an awnser to the question yet.
i was wondering, if i could use the variable thing which i did end up using on line 4, for locating stuff. i want the script to give a force feild to the player, but if someone else were to use this script, and i put my name in the lacation thing, then they wouldn't get a force feild, so i want to use m vairable "name" instead of my username so that like i said whoever else uses the script only needs to change their name on line one. if you can use variables for locating items i dont know how. if you tell me i might give you credit for teaching me that, in about every script that does this. of course im not garunteeing that. also i'll probably find a way later to make the person freeze and not be able to do anything so theres no spawnkilling and stuff, but im only using this in script builder so far
Report Abuse
slayer219 is not online. slayer219
Joined: 15 Nov 2008
Total Posts: 3445
28 Feb 2012 10:42 PM
:findFirstChild()
Report Abuse
darkkiller5555 is not online. darkkiller5555
Joined: 22 Nov 2009
Total Posts: 6359
28 Feb 2012 10:44 PM
variable = game.Workspace.NameofPlayer
Report Abuse
slayer219 is not online. slayer219
Joined: 15 Nov 2008
Total Posts: 3445
28 Feb 2012 10:50 PM
Or that two. find first child runs like this:

Location:findFirstChild(name)
Report Abuse
slayer219 is not online. slayer219
Joined: 15 Nov 2008
Total Posts: 3445
28 Feb 2012 10:51 PM
*too
Report Abuse
Sasuto10 is not online. Sasuto10
Joined: 05 May 2010
Total Posts: 183
29 Feb 2012 07:57 AM
name = "Sasuto10" --Name Here

afk = Instance.new("Hint", game.Workspace)
afk.Text = name.. " is afk..."

ff = Instance.new("Force Feild", game.Workspace:FindFirstChild(name).Torso)


i tried this but it didn't work...
Report Abuse
Sasuto10 is not online. Sasuto10
Joined: 05 May 2010
Total Posts: 183
29 Feb 2012 08:06 AM
can either of you guys give me an example of how the script would look?
i tried what dark killer said:

name = "Sasuto10" --Name Here
player = game.Workspace.YourNameHere --Replace "YourNameHere" with your full username

afk = Instance.new("Hint", game.Workspace)
afk.Text = name.. " is afk..."

ff = Instance.new("Force Feild", player.Torso)

but it wouldn't work either. but for both the script failed at the part where it is supposed to insert a Force Feild.
Report Abuse
noobkid is not online. noobkid
Joined: 17 Sep 2007
Total Posts: 649
29 Feb 2012 08:07 AM
It's not "Force Feild"..
It's ForceField
Report Abuse
Sasuto10 is not online. Sasuto10
Joined: 05 May 2010
Total Posts: 183
29 Feb 2012 05:51 PM
i found tht out already, but it still doesnt work. i got the forcefield to get into my torso and the hint to display and stuff, but the forcefield wont show, i dont know why...
Report Abuse
Sasuto10 is not online. Sasuto10
Joined: 05 May 2010
Total Posts: 183
29 Feb 2012 05:53 PM
new script:

name = "Sasuto10" --Name Here
player = game.Workspace.YourNameHere --Name again
afk = Instance.new("Hint", game.Workspace)
afk.Text = name.. " is afk..."

ff = Instance.new("ForceField", game.Workspace.player)

forcefield doesnt show and doesnt do anything, but its there...anyone know why? looked in bcgames admin commands to see how he got his to show but all that i saw was that he changed the name, i dont know if that will help me..
Report Abuse
Sasuto10 is not online. Sasuto10
Joined: 05 May 2010
Total Posts: 183
29 Feb 2012 05:58 PM
I got the script to work!:

name = "Player" --Name Here
afk = Instance.new("Hint", game.Workspace)
afk.Text = name.. " is afk..."

ff = Instance.new("ForceField", game.Workspace:FindFirstChild(name))

:D

i'll work on the freeze part next :D
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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