hello developers as well as scriptwriters, I have one problem when a local player buys a gamepass from me, he starts an auto train how to make sure that the local player does not press the button forever himself, and after the purchase the auto train itself began
my script
local ID = 236988554 – Replace This with your gamepass ID
script.Parent.MouseButton1Click:Connect(function()
game:GetService(“MarketplaceService”):PromptGamePassPurchase(game.Players.LocalPlayer,
ID)
end)
local cps = 30 -- clicks per second
local active = false
script.Parent.MouseButton1Click:connect(function()
active = not active
end)
local player = game:GetService("Players").LocalPlayer
while true do
if player and active and player.Character then
local tool = game.Players.LocalPlayer.Character:FindFirstChildOfClass("Tool")
if tool then
tool:Activate()
end
end
wait(1/cps)
end