Why does my cloned tool not work?

Hello, I wanted to ask why this happens, then i use the tool which is on the ground then everything works just fine. but if i get the tool cloned into my backpack then the tool doesn’t work. just like here:
robloxapp-20220505-1837159.wmv (3.5 MB)

1 Like

Are you clonning the tool from the client?
If you’re doing then, just clone it from the server because if you clone it from the client, scripts wont work

1 Like

i mean i want to make it so the player gets a different tool which depends on what tool name the player has on it’s leaderboard.

Edit: i am also using RemoteEvents for this.

I was asking if you were clonning the tools on a localscript

yes, then i changed it to a normal script and it still doesn’t work.

please send all codes involved

Tool part:

game.Players.PlayerAdded:Connect(function(player)
	script.Parent.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid") then
		game.ReplicatedStorage.CheckWeaponStats:FireClient(player)
	end
end)
end)

Tool Giver:



game.ReplicatedStorage.CheckWeaponStats.OnServerEvent:Connect(function(Player)
	local Backpack = Player.Backpack
	local leaderstats = Player.leaderstats
	local Character = Player.Character
	--game.Players:GetPlayerFromCharacter(Character).Backpack
	if leaderstats.Weapon.Value == "Wooden" then
		local Sword = game.ReplicatedStorage.Weapons.Wooden:Clone()
		Sword.Parent = game.Players:GetPlayerFromCharacter(Character).Backpack
	end
end)

and The Tool itself:

local db = false


script.Parent.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid") and db == false then
		db = true
		hit.Parent:FindFirstChild("Humanoid"):TakeDamage(5)
		wait(0.1)
		db = false
	end
end)

I reviewed it and it seems the problem is that you’re trying to connect a server function using fire client-

To solve this, you just have to send server info to the client and check it there.
Then if the info is correct you can send a signal from client to server telling the server to clone the tool

game.ReplicatedStorage.CheckWeaponStats.OnClientEvent:Connect(function(Player)
	local Backpack = Player.Backpack
	local leaderstats = Player.leaderstats
	local Character = Player.Character
	--game.Players:GetPlayerFromCharacter(Character).Backpack
	if leaderstats.Weapon.Value == "Wooden" then
		game.ReplicatedStorage:WaitForChild("CheckWeaponStats"):FireServer()
	end
end)

The tool giver:

game.ReplicatedStorage:WaitForChild(“CheckWeaponStats”).OnServerEvent:Connect(function(plr)

local Sword = game.ReplicatedStorage.Weapons.Wooden:Clone()
		Sword.Parent = plr.Character

end)

*OnServerEvent not OnClientEvent

you’re firing a function towards the client so, this script should be a local one

the tool giver should be a server one

I think clone it from server is best method

the code I made clones the tool from the server but checks the player’s info from the client

Ik

Just check plr not equal nil

if game.Players:GetPlayerFromCharacter(Character) then
      --your code here
end
1 Like

Lol when i saw it i was think it on local you are alr you dont write different who local or server but anyway you are alr