Im trying to clone an item from ReplicatedStorage to Backpack, but the tool wont work, theres no error that comes out on the output, ive tried using RemoteEvents's to fix this but to no luck. Ive been having this problem since last week. Heres the script for the tool and the cloning script:
Tool (LocalScript):
local player = game.Players.LocalPlayer
local char = player.CharacterAdded:Wait()
local hum = char:WaitForChild("Humanoid")
local enabled = false
local sound = Instance.new("Sound", script.Parent)
sound.SoundId = "http://www.roblox.com/asset/?id=10722059"
local anim = Instance.new("Animation", script.Parent)
anim.AnimationId = "rbxassetid://4004681604"
local loadanim = hum:LoadAnimation(anim)
script.Parent.Parent.Activated:Connect(function()
if not enabled then
enabled = true
loadanim:Play()
sound:Play()
wait(4.25)
hum:RemoveAccessories()
for i, character in pairs(char:GetDescendants()) do
if character:IsA("Shirt") then
character:Destroy()
end
if character:IsA("Pants") then
character:Destroy()
end
if character:IsA("ShirtGraphic") then
character:Destroy()
end
if character:IsA("BasePart") then
game.ReplicatedStorage.ServerEvent:FireServer(character) --This turns the character's color into orange.
end
end
enabled = false
end
end)
Cloning Script (Server Script):
script.Parent.ClickDetector.MouseClick:Connect(function(obj)
local neededamount = 30
local item = game.ReplicatedStorage["Fanta"]
local leaderboard = obj:WaitForChild("leaderstats")
local mons = leaderboard.mons
if mons.Value >= neededamount or mons.Value == neededamount then
mons.Value = mons.Value - neededamount
local newitem = item:Clone()
newitem.Parent = obj.Backpack
end
end)

1 comment
What?