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

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

Asked by 6 years ago
-- 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.

0
this should be inside the button not inside a local script Lolamtic 63 — 6y
0
and LocalPlayer only works in localcsripts Lolamtic 63 — 6y
0
Because when the roblox studio update it like when you test, it use sever script and maybe your script are client i guess MarcoVietLish -10 — 6y
0
I tried this on LocalScript doesn't work ComLBY_Dev 21 — 6y

1 answer

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

0
Downvote, you should explain things. Aimarekin 345 — 6y
1
Umm... What's the change to the script? ComLBY_Dev 21 — 6y
0
alot changd you forgot plr,assetId but i made the mistake and made backpack uppercase Lolamtic 63 — 6y
0
but i fixed that Lolamtic 63 — 6y
Ad

Answer this question