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

Studio Update Ruins my purchase script. Why doesn't this work?

-- Script, not a LocalScript
-- Acceleration Coil is just a speed coil in Lighting to clone.(Name change)
local assetId = 212641536

script.Parent.ClickDetector.MouseClick:Connect(function(plr)
	if game:GetService("MarketplaceService"):PlayerOwnsAsset(assetId) then
		game.Lighting["Acceleration Coil"]:Clone().Parent = game.Players.LocalPlayer.Backpack
		game.Lighting["Acceleration Coil"]:Clone().Parent = game.Players.LocalPlayer.StarterGear
	end
end)

-- when a player clicks on the machine, ask if they want to buy the item
script.Parent.ClickDetector.MouseClick:Connect(function(player)
local promptPurchase =	game:GetService("MarketplaceService")
	promptPurchase:PromptPurchase(player, assetId)

game.Workspace.Shelf.SpeedCoil:Clone()
end)

This script seems to work fine before the Studio Update, but does not work after the update. I think it's about experimental mode. Help me fix this script.

4 comments

0

this should be inside the button not inside a local script

0

and LocalPlayer only works in localcsripts

0

Because when the roblox studio update it like when you test, it use sever script and maybe your script are client i guess

0

I tried this on LocalScript doesn't work

1 answer

-- Script, not a LocalScript
-- Acceleration Coil is just a speed coil in Lighting to clone.(Name change)
local assetId = 212641536

script.Parent.ClickDetector.MouseClick:Connect(function(plr)
    if game:GetService("MarketplaceService"):PlayerOwnsAsset(plr,assetId) then
        game.Lighting["Acceleration Coil"]:Clone().Parent = plr.Backpack
        game.Lighting["Acceleration Coil"]:Clone().Parent = plr.StarterGear
    end
end)

-- when a player clicks on the machine, ask if they want to buy the item
script.Parent.ClickDetector.MouseClick:Connect(function(player)
local promptPurchase =  game:GetService("MarketplaceService")
    promptPurchase:PromptPurchase(player, assetId)

workspace.Shelf.SpeedCoil:Clone()
end)

4 comments

0

Downvote, you should explain things.

1

Umm... What's the change to the script?

0

alot changd you forgot plr,assetId but i made the mistake and made backpack uppercase

0

but i fixed that

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