so my clone to starter gear is not working and the parent to the inventory folder too any fix??? (Local Script)Code:
01 | 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.MouseButton 1 Click: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 ) |
ThankYou!
So I have a similar game, where I have tool gamepasses.
The problem your making is this:
Compare your code with mine.
01 | local plr = game.Players.LocalPlayer |
02 | 02 local Players = game:GetService( "Players" ) |
03 | 03 local ReplicatedStorage = game:GetService( "ReplicatedStorage" ) --gets ReplicatedStorage |
04 | 04 local ToolsFolder = ReplicatedStorage:FindFirstChild( "Tools" ) -- gets the tools folder |
05 | 05 local InventoriesFolder = ReplicatedStorage:FindFirstChild( "Inventories" ) -- gets the inventories folder |
06 | 06 local button = script.Parent -- gets the button |
07 | 07 local SpeedCoil = ToolsFolder:FindFirstChild( "SpeedCoil" ) |
08 | 08 print ( "VariablesDone!" ) --prints "VariablesDone!" |
09 | 09 --MainScript-- |
10 | 10 button.MouseButton 1 Click:Connect( function () --when a player presses the button in left click |
11 | 11 print ( "Pressed" ) -- when a player presses the button then it will print out "Pressed" |
12 | 12 local inventory_folder = InventoriesFolder [ plr.Name ] |
13 | 13 print ( "No Errror BRUH" ) |
14 | 14 SpeedCoil:Clone().Parent = plr.Backpack |
15 | 15 SpeedCoil:Clone().Parent = plr.StarterGear |
16 | 16 SpeedCoil:Clone().Parent = inventory_folder |
17 | 17 end ) |
Now check Mine:
01 | local id = 10409444 |
02 | game:GetService( "MarketplaceService" ).PromptGamePassPurchaseFinished:Connect( function (plr,ido,purchased) |
03 | if purchased and ido = = id then |
04 | game.ServerStorage.Tools.DiamondSword:clone().Parent = plr.Backpack |
05 | end |
06 | end ) |
07 | game.Players.PlayerAdded:Connect( function (plr) |
08 | plr.CharacterAdded:connect( function (char) |
09 | if game:GetService( "MarketplaceService" ):UserOwnsGamePassAsync(game.Players [ char.Name ] .UserId, id) then |
10 | game.ServerStorage.Tools.DiamondSword:clone().Parent = plr.Backpack |
11 | end |
12 | end ) |
13 | 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.
01 | 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 Tool = ToolsFolder:FindFirstChild( "SpeedCoil" ) |
08 | local GiveToolRemote = ReplicatedStorage:WaitForChild( "Tools" ):WaitForChild( "RemoteEvent" ) |
09 | print ( "VariablesDone!" ) --prints "VariablesDone!" |
10 | --MainScript-- |
11 | button.MouseButton 1 Click:Connect( function () --when a player presses the button in left click |
12 | print ( "Pressed" ) -- when a player presses the button then it will print out "Pressed" |
13 | local inventory_folder = InventoriesFolder [ plr.Name ] |
14 | print ( "No Errror BRUH" ) |
15 | GiveToolRemote:FireServer(Tool.Name) |