So like this?
indent preformatted text by 4 spaceslocal dialog = game.Workspace.Ryanthemudkip.Head.Saledialog.Dialogchoice1
local client = game:GetService(“Players”).LocalPlayer
dialog.DialogChoiceSelected:Connect(function(player, dialog)
if player ~= client then
return
end
– Services
local ReplicatedStorage = game:GetService(“ReplicatedStorage”)
local MarketplaceService = game:GetService(“MarketplaceService”)
– Setup RemoteEvent in ReplicatedStorage
local promptPurchaseEvent = Instance.new(“RemoteEvent”)
promptPurchaseEvent.Name = “PromptPurchaseEvent”
promptPurchaseEvent.Parent = ReplicatedStorage
– Listen for the RemoteEvent to fire from a Client and then trigger the purchase prompt
promptPurchaseEvent.OnServerEvent:Connect(function(player, id)
MarketplaceService:PromptPurchase(player, id)
end)
– Extra code
end)
No not necessarily. Don’t just copy paste an entire script into the function.
More like this (P.D. you don’t need a remote to prompt purchases!).
local dialog = game.Workspace.Ryanthemudkip.Head.Saledialog
local client = game:GetService("Players").LocalPlayer
local MarketplaceService = game:GetService("MarketplaceService")
dialog.DialogChoiceSelected:Connect(function(player, choice)
if player ~= client then
return
end
if choice.Name == "Dialogchoice1" --[[ or whatever it was]] then
MarketplaceService:PromptGamePassPurchase(client, id) -- Whatever the ID was
end
end)
How to post a code block
```lua
– Code here
```
Three backticks (aka grave accents then the file extension of the language. Lua is used in this case.