Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How can I clone an Item into the Players Inventory?

Hey Guys,

I currently Script on a coustom Dialog Shop System.

and I have a little Question: How can I clone an Item from the ServerStorage into the Players inventory?

Thats my Current Script:

script.Parent.MouseButton1Click:Connect(function()

local Todo = script.Parent.Todo

local plr = game.Players.LocalPlayer

if Todo.Value == "Coke" then

if plr.leaderstats.Cash.Value >= 100 then

plr.leaderstats.Cash.Value = plr.leaderstats.Cash.Value - 100

end

Todo.Value = ""

script.Parent.BackgroundTransparency = 1

script.Parent.Text = ""

script.Parent.Parent.Right.BackgroundTransparency = 1

script.Parent.Parent.Right.Text = ""

script.Parent.Parent:TweenPosition(UDim2.new(-2,0,.419,0), "Out", "Quad",1)

script.Parent.Parent.TextLabel.Text = ""

workspace:FindFirstChild(script.Parent.Todo.NPC.Value).BillboardGui.debounce.Value = false

end

end)

Thanks for help :D

1 answer

✓ Accepted answer

If you want to clone something you use :Clone() also, if you're planning on cloning something from the serverstorage make sure to use a global script because local scripts can't access serverstorage. In your case I'd use a variable that will be the item you want to clone and you'd clone it and then parent it to the backpack of the player. S = game.ServerStorage:WaitForChild("YourItem"):Clone() S.Parent = Player.Backpack

4 comments

0

And How can I do it in a Local Script?

0

I would suggest not doing that in a local script because it won't show for other players

0

wouldnt you use remote events?

0

he can use remote events,

This discussion is preserved as it was. New answers, comments, and votes are closed.