Basically I want the players to have their swords put into Starterpack, how do I do that?
Player = game.Players.LocalPlayer
Sword = game.Lightning.Sword:clone()
Sword.Parent = Player.Backpack
Basically I want the players to have their swords put into Starterpack, how do I do that?
Player = game.Players.LocalPlayer
Sword = game.Lightning.Sword:clone()
Sword.Parent = Player.Backpack
Simply put the Sword into the Starterpack in Studio!
Alternatively, put the following into your command bar:
game.Lighting.Sword.Parent = game:GetService("StarterPack")
Note: On line 3 in your code, you misspelled "Lighting"
EDIT If you meant clone a tool into a player's backpack, you would use the following:
local ServerStorage = game:GetService("ServerStorage") --Use ServerStorage instead of lighting!
local Players = game:GetService("Players")
local Sword = ServerStorage.Sword
function giveTool(player, tool)
--- Places a tool inside a player
--@param Player player the player who will receive the tool (userdata)
--@param Tool tool the tool the player will be receiving
tool:Clone().Parent = player.Backpack
end
giveTool(Players.Narrev, Sword)
If you want the game to run on a Server you would have to use ReplicatedStorage.
Actually, you don't need a script at all to insert a sword in the StarterPack. The most simple was to do this is that you can search for a sword in the toolbox, click the best sword, then from the Workspace, you can drag it into the StarterPack.
Yeah that's true, but I was making a shop gui :D!
Oh well, AlvinBloxx has a tutorial about that visit his page oon youtube.
This discussion is preserved as it was. New answers, comments, and votes are closed.
1 comment
Is this a local or server script? :)