Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How would I do this?

I'm completely stumped on how to do this, but.

I am trying to make a tool from lighting spawn into players backpacks when they join / respawn, putting it in starter pack alone does NOT work. The only way I can get it to be in game is using kohls admin, the give command.

Edit/// Was going to post the script, but it's too long to post... So here's a pastebin link if this is not against the rules...

http://pastebin.com/42qG58Jk

1 answer

--------------Put the tool into Replicated Storage-----------
local player = game.Players.LocalPlayer   --This finds the player
local clone = game.ReplicatedStorage["TOOLNAMEHERE"]:Clone()  --This gets the tool and clones it, as well as defining the clone.
clone.Parent = player.Backpack --This tells the clone where to go.
--Keep in mind, you have to show us your script, it's the best way to learn. We can point out what happened, and where the error occurred if you give us a script.

THIS NEEDS TO BE A LOCAL SCRIPT IN STARTERGUI

To go into more depth with what I'm doing

FIRST LINE

local player = The local I'm using here, defines what this should be, game.Players.LocalPlayer This is what I'm telling the local player to be. If I use local player anywhere else in the script, it will still work. Next time you use it, you don't need to use local, that's only for defining in the beginning of the script

SECOND LINE

local clone = Again, defines what clone should be game.ReplicatedStorage["TOOLNAMEHERE"] this goes into the ReplicatedStorage, which I told you to store your item in, and it looks for this tool. :Clone()This tells it to clone. It's important to use : when cloning. I don't know if clone has to be capitalized like how I did it, I think it's an optional thing.

THIRD LINE

clone.Parent I'm now using the variable I defined early to determine where this clone should be. player.BackpackThis is telling it to go to the player, and place the clone in their bag.

If you need more questions about this, either put a comment on my answer or, go to http://wiki.roblox.com . The wiki is probably the best place to look scripting stuff up.

Putting an item in StarterPack will give it to all the players if the tool is in there before the server starts. I.e. Place the tool into StarterPack. If you clone something into StarterPack, it will appear when that person resets.

4 comments

0

I'll try it out, thank you very much. I'm actually having a very hard time learning to script so this is a big help, thank you.

0

No problem ;)

0

Didn't work. Updating the post with the script I'm using.... Not skilled enough to make scripts yet, but I can edit them. //knows nearly nothing about scripting..

0

HOW DO I PUT A TOOL IN MY BACKPACK!!!!! LIKE WHAT TYPE OF TOOL AND HOW DO I GET THERE, PLS EXPLAIN

This discussion is preserved as it was. New answers, comments, and votes are closed.