Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

When I clone a tool to the toolbar it does not update and show that tool?

Asked by 2 years ago

I have a script that clones a object to starter pack after 5 seconds and it works but won't show the tool in the toolbar. I can't equip it either.

here is the script:

local hk416 = game.ReplicatedStorage.HK416
local microuzi = game.ReplicatedStorage["Micro UZI"]
local sheild = game.ReplicatedStorage.Shield
local LMG = game.ReplicatedStorage["The Little Friend"]
local m870 = game.ReplicatedStorage.M870

wait(5)
local clonedm870 = m870:Clone()
clonedm870.Parent = game.StarterPack

1 answer

Log in to vote
2
Answered by 2 years ago
Edited 2 years ago

Hi @betme778 I think I understand what's the issue.

StarterPack is where you place your tools before launching the game. That clone these child to the StarterGear in the instance of all new clients. The StarterGear of the player in turn clones these child to the Backpack when a new character spawn and this is where the toolbar looks to know what the client needs to see.

So the correct way to equip everyone with a tool is to find all players first. The service Players own a method which makes it possible to obtain a table with inside all the players present in the server.

game:GetService("Players"):GetPlayers()

We can now set the value of a variable to this table and use it with a for loop to read it.

local Participants = game:GetService("Players"):GetPlayers()

for index, player in pairs(Participants) do
    -- code
end

You can now find the Backpack of all player and clone the tool on all of it. Hope I've help you!

0
please explain how to implement this betme778 6 — 2y
Ad

Answer this question