Tool breaks when I clone it to player's backpack

  1. What do you want to achieve? Keep it simple and clear!
    For an ability system in my game, you can unlock the moves via a gui and the tool will be sent to the player’s backpack. But when my tool is parented to their backpack, it refuses to work and yields no errors in output. The tool does work when parented to the backpack from the start, but I need it to be parented with this method.

  2. What is the issue? Include screenshots / videos if possible!


    Giving player the tool via serverscript.

local
Top part of the local script in tool, may be main cause of issue?

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I have tried disabling the scripts before I re-enable them in backpack,
    I have tried different locations to keep the tool,
    I have tried defining Character in different ways in the tool local script and never works, etc.
2 Likes

I believe that the problem is the line

local Character = Player.CharacterAdded:Wait()

When you start with the tool in the backpack, the script runs before the character loads, but when you clone it from ReplicatedStorage or ServerStorage, the code doesn’t run until it’s in the backpack. When this happens, the character may have already loaded, so I recommend you change the line to

local Character = Player.Character or Player.CharacterAdded:Wait()

Other than this, I don’t don’t see anything else that should be preventing the code from running.

I will say that there is no need to disable the scripts after you clone the tool, just leave it as it is.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.