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: Why isn't the tool in my backpack?

Previous Thread :: Next Thread 
robloxboy54 is not online. robloxboy54
Joined: 20 Nov 2010
Total Posts: 286
27 Jun 2013 10:41 AM
c=game.Workspace.trov:clone()
c.Parent=game.StarterPack

Why isn't it showing up?
Report Abuse
robloxboy54 is not online. robloxboy54
Joined: 20 Nov 2010
Total Posts: 286
27 Jun 2013 10:44 AM
Hello? BUMP*
Report Abuse
rosenburger is not online. rosenburger
Joined: 03 Aug 2009
Total Posts: 8407
27 Jun 2013 10:46 AM
Place your tool in lighting then use this script and make your tool named "trov" I guess.

game.Players.PlayerAdded:connect(function(plr)
plr.CharacterAdded:wait()
if plr.Character then
game.Lighting.trov:clone().Parent = plr.Backpack
end
end)

ʟᴇʟᴇʟᴇʟ (ง'̀ ͜ʖ'́ง)
Report Abuse
rosenburger is not online. rosenburger
Joined: 03 Aug 2009
Total Posts: 8407
27 Jun 2013 10:46 AM
What I just scripted is exactly what would happen when you just put the tool in starterpack and not even use any scripts.

ʟᴇʟᴇʟᴇʟ (ง'̀ ͜ʖ'́ง)
Report Abuse
IAmReallyAwesome is not online. IAmReallyAwesome
Joined: 05 Mar 2010
Total Posts: 7371
27 Jun 2013 10:47 AM
When you reset, does it show up?

Just putting it into the game.StarterPack will make it available to all characters when they respawn. If you want to give it to only one player, you need to put it into the Player's backpack. This can be done easily by using a touch function.

script.Parent.Touched:connect(function(hit)
t = game.Workspace.trov:clone()
t.Parent = game.Players:GetPlayerFromCharacter(hit.Parent).Backpack
end)

I believe that would work.
Report Abuse
IAmReallyAwesome is not online. IAmReallyAwesome
Joined: 05 Mar 2010
Total Posts: 7371
27 Jun 2013 10:52 AM
Actually it would be:

script.Parent.Touched:connect(function(hit)
t = game.Workspace.trov:clone() --(I'd recommend putting trov into Lighting instead)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if not Player then return end
t.Parent = player.Backpack
end)
Report Abuse
rosenburger is not online. rosenburger
Joined: 03 Aug 2009
Total Posts: 8407
27 Jun 2013 10:57 AM
t = game.Workspace.trov:clone()
t.Parent = game.Players:GetPlayerFromCharacter(hit.Parent).Backpack

That can be shortened since it won't be needed access later on, I'm assuming.

workspace.trov:clone().Parent = blaghblahblah

ʟᴇʟᴇʟᴇʟ (ง'̀ ͜ʖ'́ง)
Report Abuse
IAmReallyAwesome is not online. IAmReallyAwesome
Joined: 05 Mar 2010
Total Posts: 7371
27 Jun 2013 11:30 AM
Acutally, it is needed to check that a character is touching, and not something else (such as a hat or a tool). In fact, the script should really be:

script.Parent.Touched:connect(function(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if not Player then return end
t = game.Workspace.trov:clone() --(I'd recommend putting trov into Lighting instead)t.Parent = player.Backpack
end)

If a tool or hat touches the part, this way the script won't glitch out.
Report Abuse
IAmReallyAwesome is not online. IAmReallyAwesome
Joined: 05 Mar 2010
Total Posts: 7371
27 Jun 2013 11:31 AM
Gah, a line ran together XD

script.Parent.Touched:connect(function(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if not Player then return end
t = game.Workspace.trov:clone() --(I'd recommend putting trov into Lighting instead)
t.Parent = player.Backpack
end)
Report Abuse
iceywind is not online. iceywind
Joined: 10 Aug 2009
Total Posts: 4424
27 Jun 2013 11:37 AM
c = game.Lighting.trov:clone().Parent = game.Players.LocalPlayer.StarterGear

--you may have to change StarterGear to Backpack

--By IceyWind
Report Abuse
iceywind is not online. iceywind
Joined: 10 Aug 2009
Total Posts: 4424
27 Jun 2013 11:38 AM
Guys, he wants the players to SPAWN with the weapons/tools, not touch a brick to get them.

~IceyWind
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