I have a question since some time and is in this script:
game.Workspace.Lobby.LobbyFloor.CanCollide = false wait(2) **game.ReplicatedStorage.JetPack:Clone() game.ReplicatedStorage.JetPack.Parent = game.Players.LocalPlayer.Backpack game.ReplicatedStorage.HyperlaserGun:Clone() game.ReplicatedStorage.HyperlaserGun.Parent = game.Players.LocalPlayer.Backpack**
When i want to give the guns to the users that play my game i write this to my scripting knowledge ('till i write this question) The game.ReplicatedStorage.HyperlaserGun:Clone() is for clone the gun to then move it to the player's backpack but that doesn't work for me.
Do you have any solution for this?
Thanks in advance.
You didn't set a variable for the cloned Laser Gun.
local ReplicatedStorage = game:GetService("ReplicatedStorage") local Players = game:GetService("Players") workspace.Lobby.LobbyFloor.CanCollide = false wait(2) for i,Player in pairs(Players:GetPlayers()) do local newJetpack = ReplicatedStorage.JetPack:Clone() newJetPack.Parent = Player.Backpack local newLaserGun = ReplicatedStorage.HyperlaserGun:Clone() newLaserGun.Parent = Player.Backpack end
In the code above we have a loop that loops through all the players. We create two variables for each of our cloned items. Now we parent those into the Player's backpack. The loop we have above gets all of the players and repeats these instructions.
Hope this helped!
you dont even need to do it like that guy answered, u can clone and parent a model at the same time, this would be the script
game.ReplicatedStorage.JetPack:Clone().Parent = game.Players.LocalPlayer.Backpack game.ReplicatedStorage.HyperlaserGun:Clone().Parent = game.Players.LocalPlayer.Backpack