so I have a simple skip stage script here
--Assuming this is a LocalScript
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoidRootPart = character:WaitForChild("HumanoidRootPart")
local valuesFolder = player:WaitForChild("Values")
local checkpointValue = valuesFolder.CheckpointValue
local marketplaceService = game:GetService("MarketplaceService")
local button = player.PlayerGui:WaitForChild("ScreenGui").TextButton
local gamepassId = 989954955
local collectionService = game:GetService("CollectionService")
local checkpointsTag = collectionService:GetTagged("Checkpoints")
local checkpointsFolder = workspace:WaitForChild("Checkpoints")
-- The checkpointTag represents checkpoints in the game. All of them are stored under checkpointsFolder and are named 'Checkpoint1', 'Checkpoint2', 'Checkpoint3', and so on.
for _, checkpoint in checkpointsTag do
checkpoint.Touched:Connect(function()
checkpointValue.Value = tonumber(checkpoint.Name:sub(11,11)) -- This sets the checkpointValue's value to the number in the touched checkpoint
checkpointValue.Value += 1
end)
end
button.MouseButton1Click:Connect(function()
marketplaceService:PromptGamePassPurchase(player, gamepassId)
end)
marketplaceService.PromptGamePassPurchaseFinished:Connect(function(player, gamepassId, wasPurchased)
if wasPurchased == true then
checkpointValue.Value += 1
humanoidRootPart.CFrame = checkpointsFolder:FindFirstChild("Checkpoint" .. checkpointValue.Value).CFrame + Vector3.new(0,5,0)
end
end)
Should this system be done on a ServerScript or a LocalScript?