so my clone to starter gear is not working and the parent to the inventory folder too any fix??? (Local Script)Code:
local plr = game.Players.LocalPlayer local Players = game:GetService("Players") local ReplicatedStorage = game:GetService("ReplicatedStorage")--gets ReplicatedStorage local ToolsFolder = ReplicatedStorage:FindFirstChild("Tools")-- gets the tools folder local InventoriesFolder = ReplicatedStorage:FindFirstChild("Inventories")-- gets the inventories folder local button = script.Parent-- gets the button local SpeedCoil = ToolsFolder:FindFirstChild("SpeedCoil") print("VariablesDone!")--prints "VariablesDone!" --MainScript-- button.MouseButton1Click:Connect(function()--when a player presses the button in left click print("Pressed")-- when a player presses the button then it will print out "Pressed" local inventory_folder = InventoriesFolder[plr.Name] print("No Errror BRUH") SpeedCoil:Clone().Parent = plr.Backpack SpeedCoil:Clone().Parent = plr.StarterGear SpeedCoil:Clone().Parent = inventory_folder end)
ThankYou!
So I have a similar game, where I have tool gamepasses.
The problem your making is this:
Compare your code with mine.
local plr = game.Players.LocalPlayer 02 local Players = game:GetService("Players") 03 local ReplicatedStorage = game:GetService("ReplicatedStorage")--gets ReplicatedStorage 04 local ToolsFolder = ReplicatedStorage:FindFirstChild("Tools")-- gets the tools folder 05 local InventoriesFolder = ReplicatedStorage:FindFirstChild("Inventories")-- gets the inventories folder 06 local button = script.Parent-- gets the button 07 local SpeedCoil = ToolsFolder:FindFirstChild("SpeedCoil") 08 print("VariablesDone!")--prints "VariablesDone!" 09 --MainScript-- 10 button.MouseButton1Click:Connect(function()--when a player presses the button in left click 11 print("Pressed")-- when a player presses the button then it will print out "Pressed" 12 local inventory_folder = InventoriesFolder[plr.Name] 13 print("No Errror BRUH") 14 SpeedCoil:Clone().Parent = plr.Backpack 15 SpeedCoil:Clone().Parent = plr.StarterGear 16 SpeedCoil:Clone().Parent = inventory_folder 17 end)
Now check Mine:
local id = 10409444 game:GetService("MarketplaceService").PromptGamePassPurchaseFinished:Connect(function(plr,ido,purchased) if purchased and ido == id then game.ServerStorage.Tools.DiamondSword:clone().Parent = plr.Backpack end end) game.Players.PlayerAdded:Connect(function(plr) plr.CharacterAdded:connect(function(char) if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(game.Players[char.Name].UserId, id) then game.ServerStorage.Tools.DiamondSword:clone().Parent = plr.Backpack end end) end)
Moderate this in your own way.
I don't have much experience with the StarterGear folder, but I assume that the server is cloning this folder to your backpack whenever a player spawns. As a result, attempting to put tools in StarterGear from the client may not work. You'd have to use a RemoteEvent.
local plr = game.Players.LocalPlayer local Players = game:GetService("Players") local ReplicatedStorage = game:GetService("ReplicatedStorage")--gets ReplicatedStorage local ToolsFolder = ReplicatedStorage:FindFirstChild("Tools")-- gets the tools folder local InventoriesFolder = ReplicatedStorage:FindFirstChild("Inventories")-- gets the inventories folder local button = script.Parent-- gets the button local Tool = ToolsFolder:FindFirstChild("SpeedCoil") local GiveToolRemote = ReplicatedStorage:WaitForChild("Tools"):WaitForChild("RemoteEvent") print("VariablesDone!")--prints "VariablesDone!" --MainScript-- button.MouseButton1Click:Connect(function()--when a player presses the button in left click print("Pressed")-- when a player presses the button then it will print out "Pressed" local inventory_folder = InventoriesFolder[plr.Name] print("No Errror BRUH") GiveToolRemote:FireServer(Tool.Name) end) --PUT THIS IN A SERVER SCRIPT IN SERVERSCRIPTSERVICE local ReplicatedStorage = game:GetService("ReplicatedStorage") local Tools = Instance.new("RemoteEvent", ReplicatedStorage.Tools) local ToolsFolder = ReplicatedStorage:FindFirstChild("Tools") local InventoriesFolder = ReplicatedStorage:FindFirstChild("Inventories") Tools.OnServerEvent:Connect(function(player, Toolname) local Tool = ReplicatedStorage:FindFirstChild(Toolname) if Tool then Tool:Clone().Parent = player.StarterGear Tool:Clone().Parent = player.Backpack local inventory_folder = InventoriesFolder[player.Name] Tool:Clone().Parent = inventory_folder end end)