i am making more weapons for my crates and it wont clone into my backpack... here are the scripts

-- this is a local script
local ItemTable = {"ZAJ95","Trench gun","Thompson","Sta52","Sta11","Spear","Spaz 12","SPAS12","RPG-7","Panzercshek","NinjaDart","Mk 16 Holo SD","Machine gun","Machete","MP5K","MP40","M4A1(-)","M4A1","M4A1","M4A1","M416","M24","M24","M22","M16","M14 EBR","M1 Garand","Lancer","LMG36","Kar 98k","Javelin","FG42","Dual DE","Double Barrel","Colt.45","Bolt-Action","Bazooka","BarGun","Ballistic Knife","AwesomeTriedent","AssultRifle","Ak-47","AWC G2","Ak47","ACR","A Bow","9mm.luger","50.Cal"}-- the list of items
local SpinDeb = false
local ShouldStop = false
local TextLabel = script.Parent.Parent.ItemDisplayer
local RP = game:GetService("ReplicatedStorage")
local Remote = RP.RecieveItemExotic
local cash = game.Players.LocalPlayer.leaderstats.Cash

script.Parent.MouseButton1Click:Connect(function() 
	if cash.Value >= 5000 then
		cash.Value = cash.Value -5000
	if SpinDeb then return end
	SpinDeb = true
	spawn(function()
		wait(5)
		ShouldStop = true
	end)
	
	
	
	math.randomseed(tick())
	
	
	
	repeat
		local ItemDisplay = ItemTable[math.random(1,#ItemTable)]
			TextLabel.Text = ItemDisplay
			local sound = Instance.new("Sound")
			sound.Parent = game.Workspace
			sound.SoundId = "rbxassetid://421058925"
			sound:Play()
			wait(0.1)
			sound:Destroy()
	until ShouldStop == true
	
	local ChosenItem = TextLabel.Text
	wait(0.5)
		TextLabel.Text = 'You Won '..ChosenItem
		script.Parent.Text = 'CLICK TO SPIN'
		local sound = Instance.new("Sound")
		sound.Parent = game.Workspace
		sound.SoundId = "rbxassetid://138222365"
		sound:Play()
		wait(1)
		sound:Destroy()
	script.Parent.Parent.Visible = false
	Remote:FireServer(ChosenItem) -- Fires remote event
	ShouldStop = false
	wait(5)
		SpinDeb = false
	end
	if cash.Value <= 5000 then
		local fail = Instance.new("Sound")
		fail.Parent = game.ReplicatedStorage
		fail.SoundId = "rbxassetid://620887707"
		fail:Play()
		TextLabel.Text = "You Dont Have Enough Money!"
		wait(5)
		TextLabel.Text = "Item"
	end
end)

Here is the script that belongs in serverscriptservice... this is the part that wont clone the chosen item

local RP = game:GetService("ReplicatedStorage")
local Remote = RP.RecieveItemExotic
local ItemFolder = RP.Eitem

Remote.OnServerEvent:Connect(function(player,itemname) -- gets the event
	if ItemFolder:FindFirstChild(itemname) then
		local cloned = ItemFolder[itemname]:Clone() --PROBLEM
		cloned.Parent = player.Backpack
	end
end)

2 comments

0

whats the exact error or none?

0

local cloned = ItemFolder:FindFirstChild(itemname):Clone() ?