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

Why doesn't the item clone into both places?

It doesn't clone into both places.

local MarketplaceService = game:GetService("MarketplaceService")
local player = game.Players.LocalPlayer
local item = game.ServerStorage.SegwayHoverboard:Clone()
local market = game:GetService("MarketplaceService")

script.Parent.MouseButton1Click:connect(function()
    market:PromptPurchase(player, 237980461)
MarketplaceService.PromptPurchaseFinished:connect(function(player, assetId, isPurchased)
    if isPurchased then
        game.SoundService.Ding:Play()
    item.Parent = player.Backpack
    item.Parent = player.StarterGear
    player.Backpack.SegwayHoverboard.CanBeDropped = false
        end
end)
end)

2 answers

local MarketplaceService = game:GetService("MarketplaceService")
local player = game.Players.LocalPlayer
local item = game.ServerStorage.SegwayHoverboard:Clone()
local market = game:GetService("MarketplaceService")
 
script.Parent.MouseButton1Click:connect(function()
    market:PromptPurchase(player, 237980461)
MarketplaceService.PromptPurchaseFinished:connect(function(player, assetId, isPurchased)
    if isPurchased then
        game.SoundService.Ding:Play()
   Item1 = item:Clone()
   Item1.Parent = player.Backpack
   Item2 = item:Clone()
   Item2.Parent = player.StarterGear -- You got to :Clone() for each object
    player.Backpack.SegwayHoverboard.CanBeDropped = false
        end
end)
end)

1 comment

0

And make sure to use local Item1 = blah blah blah unlike what I did.

It looks like you're using a localscript. Correct me if I'm wrong, but localscripts can't access the serverstorage. Change the path to Replicated Storage (Recommended) or lighting, insert the item there, and try again.

EDIT: I just realized, if you want it to replicate, the above method won't work. You can use Remote Events if you wish for it to replicate.

1 comment

0

Accept answer if this helped, please :)

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