Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Tool can't be cloned at the same time for 2 different people?

Asked by
zomspi 541 Moderation Voter
5 years ago

I made a clone script for a tool except when 1 player equips it, the other player who already has it equipped loses it? Here is my script:

Local script

local item = script.Parent
local tool = game.ReplicatedStorage.WoodenSword
local clonedTool = tool:Clone()

item.MouseButton1Click:connect(function()
    game.ReplicatedStorage.WoodenSwordRE:FireServer()



end)


Server Script

local tool = game.ReplicatedStorage.WoodenSword
local clonedTool = tool:Clone()

game.ReplicatedStorage.WoodenSwordRE.OnServerEvent:Connect(function(Player)

    clonedTool.Parent = Player.Backpack
end)





I also have a remote event called WoodenSwordRE

Can anyone help? Thanks!

1 answer

Log in to vote
0
Answered by
Azarth 3141 Moderation Voter Community Moderator
5 years ago
Edited 5 years ago

You need to clone a new Tool every time the Event is called, else you're just moving around the original clone to different Parents.

local tool = game.ReplicatedStorage:WaitForChild("WoodenSword")

game.ReplicatedStorage:WaitForChild("WoodenSwordRE").OnServerEvent:Connect(function(Player)
    tool:Clone().Parent = Player.Backpack
end)



Ad

Answer this question