Should I do 'skip stage' systems on the client or the server?

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?

Running it on the client-side could allow exploiters to skip stages without purchasing the gamepass

Ideally the client requests the server to skip the stage, the server checks to see if the client owns the gamepass, and if so, allows the client to skip the stage. The server should also check to make sure that the client doesn’t skip more stages than the pass allows them to

1 Like

This can be done through remote functions right?

I’m asking because I haven’t learnt them yet

1 Like

Correct, you’ll need to use RemoteFunctions. You could use RemoteEvents as well, if you wish to make it so that the server is also responsible for skipping the stage, the benefit being that the server no longer needs to check to see if the client skipped more stages than they should’ve

1 Like

Thank you for the help.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.