What do you want to achieve? I want to make a phase 2 to a class(kinda) and I made a tool that gives you 2 more tools and deletes your current ones.
What is the issue? I have tried going into the backpack and waiting for a child to appear.
local backpack = Players:FindFirstChildOfClass("Backpack")/ --game.Startergui.Parent.Backpack is another one I´ve tried
local swrd = backpack:WaitForChild("Sword")
local MultiSlash = backpack:WaitForChild("Multi-Slash") -- getting the backpack and the tools I want to destroy
local function Activated(Activated)
-- I have also tried backpack:ClearAllChildren()
What solutions have you tried so far? Did you look for solutions on the Developer Hub? I have tried searching for it but I couldn´t find anything
The script for destroying the tool and adding the other tools are in other ones so that I could understand why there were problems.
I’m not a good scripter so maybe that´s why, also, in case it’s necessary, the tools are not in the starter pack but rather in lighting and then cloned into the player´s backpack when a GUI button is pressed(this is my first post so if I got something wrong/didn´t understand something completely please tell me!)
is the script local or a normal script?
I made it local since that is how the script that I made to destroy the tool that is used to transition to phase 2 when activated is destroyed.
Local scripts don’t replicate to the server
Ok let me change this and check how it goes
I changed it to a script and it still didn´t do anything, I also tried changing the backpack to another variable and neither of it worked
Use a localscript and when the tool is triggered, use RemoteEvents which fire to the server and then remove the tool from the player’s backpack/character.
local Players = game:GetService("Players")
local tool = script.Parent
local player = Players:GetPlayerFromCharacter(tool.Parent)
I have 2 tools that I wish to destroy, and not any of them are from the tool where the script is, there is already a different script where the tool where all the scripts are is destroyed, but I think you refer to destroying the tools and only used singular, I will be attempting to use the remoteEvent idea anyways, thanks
It didn´t appear to work, maybe I’m just bad with remotevents but I don’t know,
This also didn´t work, I tried it in a normal script and in a local one in case it changed anything, no it didn´t
local players = game:GetService"Players"
local tool = script.Parent
local character = tool.Parent
local player = players:GetPlayerFromCharacter(character)
if player then
local humanoid = character:FindFirstChildOfClass"Humanoid"
local backpack = player:FindFirstChildOfClass"Backpack"
if humanoid and backpack then
for _, tool in ipairs(backpack:GetChildren()) do
if tool:IsA"Tool" then
This is working on my end.
this worked, thank you so much!