Tool cannot be activated

Hello everyone, after I finished developing my weapon (an MP5 from the Federal Police in Germany), it doesn’t work when added to the player’s backpack by ServerScriptServer.

The tool is located in ReplicatedStorage and is copied by a script. Here is the short excerpt from the script:

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local gun1 = ReplicatedStorage.weapons:WaitForChild("MP5")

local weapon1 = gun1:Clone()
weapon1.Parent = player.Backpack

After desperately searching for solutions in the forum, I couldn’t find anything.
Even the ManuelActivationOnly is turned off in the tool, so I can’t understand why it doesn’t work.
Or I missed something which is the reason why it doesn’t work. Unfortunately, this happens to me often. But if the tool is picked up in the workspace by the player, it works.

I made a video where you can see the problem visually.
https://youtu.be/H-QG9fCjNPc

I doubt that the tool is not activated properly for whatever reason.

2 Likes

The reason it can’t be activated is that you’re probably copying it on the client (Local Script). Make sure to clone and put the tool in the player’s backpack from the server (Server Script).

The tool is copied from a ServerScript, not from a LocalScript and is in the ServerScriptService. It is triggered by the player selecting his team. Or do I have to copy the tool from somewhere else and not from ReplicatedStorage?

Sorry for the late response. Is this a custom-made gun? Also, have you tried checking the output for any errors (ex: something is missing when the script is originally called, but when you move the gun in and out of the character the script is rerun and it would be there that time)? If the example is correct, then the fix would be adding something like WaitForChild or checking if an instance is nil.

All good, everyone have time to answer as long as Roblox doesn’t close it :slight_smile:

The weapon was completely built by me (some was taken from a tutorial due to Raycast) and there are no errors in testing that can be attributed to this. However, I recently had errors due to values, which I solved with WaitForChild.

However, I’m starting to doubt that this is due to the cloning of the tool, because the weapon isn’t exactly small in terms of the elements. That’s why I’m currently trying to develop a time period between cloning and the backpack.

I think I have found the solution to the problem. However, I still have to test it extensively with several players before I label it as a solution.

I read in another forum post that :Wait() codes can cause the script in the tool to stop working because, in short, it “waits indefinitely” even though it already exists.

And it was exactly this code that caused the tool to not work properly:

if not Humanoid.RootPart then 
   Humanoid:GetPropertyChangedSignal("RootPart"):Wait() 
end

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