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

Why doesn't the item clone into both places?

Asked by 6 years ago

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

Log in to vote
1
Answered by 6 years ago
Edited 6 years ago
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)

0
And make sure to use local Item1 = blah blah blah unlike what I did. protectiveebob 221 — 6y
Ad
Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

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.

0
Accept answer if this helped, please :) DaWarTekWizard 169 — 6y

Answer this question