but the tool works with remote events though, or do you want me to clone it with a remote event?
Make the scripts in the tool work with remote events using a localscript to fire it then the server to do stuff
but that’s how it already works
Are you cloning it on the client?
I’m cloning it with a script, not a local script (the script is in workspace)
Show me your code for your tool and script
we need to see the script to help you
That’s where the tool is located and the code is in a local script
local function onActivate()
script.Parent.FireEvent:FireServer(playerMouse.Hit.Position)
end
local function onEquip()
equipped = true
end
local function onUnequip()
equipped = false
end
script.Parent.Equipped:Connect(onEquip)
script.Parent.Unequipped:Connect(onUnequip)
script.Parent.Activated:Connect(onActivate)
what exactly do you want to do? you said you had trouble cloning the tool which doesnt make sense considering that you’re firing the position
I’m trying to make like a weapon giver, when you touch the weapon giver it will clone the tool and put it into the player’s backpack
can you show the code that clones the tool?
but when the tool gets cloned, the scripts just won’t work, no errors not anything
local marketplaceService = game:GetService("MarketplaceService")
local players = game:GetService("Players")
local gamepassId = script.Parent:GetAttribute("GamepassId")
local weaponName = script.Parent:GetAttribute("WeaponName")
local debounce = false
local cooldown = 5
local function onTouch(hit)
if not debounce then
if hit.Parent:FindFirstChild("Humanoid") then
local selectedPlayer = players:GetPlayerFromCharacter(hit.Parent)
if gamepassId ~= 0 then
local gamepassCheck = marketplaceService:UserOwnsGamePassAsync(selectedPlayer.UserId, gamepassId)
if gamepassCheck then
if not selectedPlayer.Backpack:FindFirstChild(weaponName) and not hit.Parent:FindFirstChild(weaponName) then
for i, v in pairs(game.ReplicatedStorage.SystemSaves.Weapons:GetChildren()) do
if v.Name == weaponName then
debounce = true
local newWeapon = v:Clone()
newWeapon.Parent = selectedPlayer.Backpack
wait(cooldown)
debounce = false
else
print("Weapon not found!")
end
end
end
else
selectedPlayer:Kick("Banned for Cheating")
end
else
if not selectedPlayer.Backpack:FindFirstChild(weaponName) and not hit.Parent:FindFirstChild(weaponName) then
for i, v in pairs(game.ReplicatedStorage.SystemSaves.Weapons:GetChildren()) do
if v.Name == weaponName then
debounce = true
local newWeapon = v:Clone()
newWeapon.Parent = selectedPlayer.Backpack
wait(cooldown)
debounce = false
else
print("Weapon not found!")
end
end
end
end
end
end
end
script.Parent.Touched:Connect(onTouch)
could you show the code that actually clones the given weapon?
It checks if you have a specific gamepass, then it clones the tool and put’s it into the inventory if you don’t have the tool already and all of it works perfectly but once the tool is cloned and moved into the player’s backpack, the scrips are just not working
so theres more tools in your weapons folder as well?
yes, but all of them have the same concept and all of them don’t work when cloned and moved, but all of them do work when I get them from the StarterPack at start
maybe place the script in ServerScriptService instead, and mention the part that players will touch like this:
local part = game.Workspace:FindFirstChild("") -- name of part
(i dont think this will work, try the below method)
or maybe just have the full tool inside of workspace, and then clone that same tool in workspace when a player will touch the specific part of the tool (and have the script inside of the specific part of the tool you want to player to touch)
Not true, it’s just that scripts don’t run in ReplicatedStorage. It’s sufficient enough as a storage, though personally I wouldn’t store tools in ReplicatedStorage because the client doesn’t have a reason to be interacting directly with the tools until they are added to the backpack.
For reference, just to try and repro this anyway, I also tried to get a Tool from ReplicatedStorage over to my backpack and the tool worked as intended. See below for the tool in my backpack (I was too lazy to add a Handle so it’s a tool without a handle and RequiresHandle off) and the output for the prints coming from the LocalScript firing a RemoteEvent for the server to print something.
OP isn’t providing enough detail to know why specifically their tool doesn’t work. Repro file if you want to observe this behaviour yourself: ToolCloneRepro.rbxl (29.7 KB)
Remember to do your research and testing before replying!