You are cloning it client-side, meaning that it will only be seen by the client and that's why it's not working most likely. Instead of doing it in the local script, you should send a remote containing tool name that the server will handle and clone the tool.
Something like this:
Client code (in the localscript):
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Remote = ReplicatedStorage:WaitForChild("Remote")
local player = game.Players.LocalPlayer
local Debounce = true
script.Parent.MouseButton1Click:Connect(function(click)
if Debounce then
Debounce = not Debounce
Remote:FireServer("ClassicTimebomb")
wait(.5)
Debounce = not Debounce
end
end)
Server code (Script inside ServerScriptService):
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Remote = ReplicatedStorage:WaitForChild("Remote")
Remote.OnServerEevent:Connect(function(Player,Item)
if Item == "ClassicTimebomb" then
local Price = 150
local Cash = Player:FindFirstChild("leaderstats").Cash
if Cash then
if Cash.Value >= Price then
Cash.Value = Cash.Value - Price
ReplicatedStorage.Tools:FindFirsChild(Item):Clone().Parent = Player:WaitForChild("Backpack")
end
end
end
end)
Note: I didn't test it so if there are any problems or questions feel free to comment.
2 comments
Did you try printing on each line to see where your code runs up to.
Yes, the code goes all the way through. I have the weapon in my backpack, and I can equip it, however, when I try to click to use the weapon it refuses to work.