I am working on a round based game. When a round starts, a new map is chosen, and players get a tool. The same tool.
Problem
Here comes the problem.
When I clone a Tool into a player’s Backpack, the tool breaks. I find it weird as putting it in StarterPack magically makes it work.
Relevant Code
local contestants = {};
local spawns = Workspace.Spawns:GetChildren();
for _, client in ipairs(Players:GetPlayers()) do
if (client.Character and client.Character.Humanoid.Health > 0) then
client.Character:SetPrimaryPartCFrame(table.remove(spawns, 1).CFrame);
tool:Clone().Parent = client.Backpack;
CollectionService:AddTag(client, IN_GAME_TAG);
table.insert(contestants, client);
end
end
If you need more code let me know and I will happily provide more
And tool is defined as local tool = ServerStorage:WaitForChild("Sub Machine Gun");
Could be how your tool script is done as my game uses a tool clone and doesn’t have this issue.
Could you send some of the code so we can help you identify the problem?
When you first spawn in you get the weapon just fine. But when you die the tool completely breaks. The code for giving the tool is
-- I was so tired
game:GetService("Players").PlayerAdded:Connect(function(player)
print("Player added", player)
player.CharacterAdded:Connect(function(character)
print("Character added", character)
local clone = game:GetService("ServerStorage").M4:Clone()
clone.Parent = character -- i tried humanoid:EquipTool but that doesn't work
print("Equipped")
end)
player.CharacterRemoving:Connect(game.Destroy)
end)
In the gun scripts (the gun is located in ServerStorage) I have added print("Activated"). It works even after I die but for some reason the gun won’t shoot.
tool.Activated:Connect(function()
print("Activated")
if reloading then
print("Is this the issue") -- when I press R and shoot while reloading this prints
return
end
-- Bruh and fired print just fine
is_down = true
while is_down do
print("BRUHHHHHHHHHH")
remotes.Shoot:FireServer(cursor.Hit.Position)
print("Fired")
wait(0.1)
end
end)
And part of the server side for the Shoot remote is