Should I make this Client Sided Or ServerSided? (Passcode Door)

Should I make this Colorcode Door be on the client or the server. I am having trouble deciding what side I should do because the cons and pros for each one are strong
Server Pros

  • Invisible To Exploiters

Server Cons

  • People Can Mess Up The Persons Current Sequence

Client Pros

  • Can’t Be Messed Up By Other Players

Client Cons

  • Visible To Exploiters Which Means They Could Identify The Correct Code

When it’s visible to exploiters it ruins the point of having a secret code, but when it’s server-sided other players can mess up another player’s current sequence which can be annoying. I honestly don’t know what to do here. Is there a way to have it on the client but not visible to exploiters? Anyways here’s the script:

local PassCodeDoor = workspace.ColorCodePassCodeDoor
local ProximityPromptService = game:GetService("ProximityPromptService")
local CurrentCodeString = ""
local CorrectCodeString = "Red|Blue|Orange|Orange|Purple|Green"
local NumberOfColors = #string.split(CorrectCodeString,"|")
CorrectCodeString = table.concat(string.split(CorrectCodeString,"|"),"")
local CurrentColorIndex = 0
function ButtonPush(Button)
	local TweenService = game:GetService("TweenService")
	local TI = TweenInfo.new(1)
	local BackX = -88.75
	local OrginalPos = Button.Position
	for _, Prompt in pairs(PassCodeDoor:GetDescendants()) do
		if Prompt:IsA("ProximityPrompt") then
			Prompt.Enabled = false
		end
	end
	TweenService:Create(Button, TI, {Position = Vector3.new(BackX, Button.Position.Y, Button.Position.Z)}):Play()
	wait(1)
	SetFire(Button.Color)
	TweenService:Create(Button, TI, {Position = OrginalPos}):Play()
	wait(1)
	for _, Prompt in pairs(PassCodeDoor:GetDescendants()) do
		if Prompt:IsA("ProximityPrompt") then
			Prompt.Enabled = true
		end
	end
end
function SetFire(Color)
	if typeof(Color) == "Color3" then
		local Fire = PassCodeDoor.ColorCodeBlockMesh[CurrentColorIndex + 1].Fire
		if Fire then
			Fire.Color = Color
		end
	end
end
function ActivateDoor()
	local TweenService = game:GetService("TweenService")
	local TI = TweenInfo.new(2.5)
	local OpenGoal = {
		Position = Vector3.new(-91.75, -5, -5.5);
		Size = Vector3.new(4.5, 12, 10)
	}
	local ClosedGoal = {
		Position = Vector3.new(-91.75, 2, -5.5);
		Size = Vector3.new(4.5, 26, 10)
	}	
	TweenService:Create(PassCodeDoor.Door, TI, OpenGoal):Play()
	wait(4)
	TweenService:Create(PassCodeDoor.Door, TI, ClosedGoal):Play()
end
ProximityPromptService.PromptTriggered:Connect(function(PromptInstance, Player)
	if not PromptInstance:FindFirstAncestor(PassCodeDoor.Name) then return end
	ButtonPush(PromptInstance.Parent)
	CurrentCodeString = CurrentCodeString..tostring(PromptInstance.Parent.Name)
	CurrentColorIndex += 1
	if CurrentColorIndex == NumberOfColors then
		CurrentColorIndex = 0
		if CurrentCodeString == CorrectCodeString then
			CurrentCodeString = ""
			for _, Fire in pairs(PassCodeDoor.ColorCodeBlockMesh:GetDescendants()) do
				if Fire:IsA("Fire") then
					Fire.Color = Color3.new(0,1,0)
				end
			end
		else
			for _, Fire in pairs(PassCodeDoor.ColorCodeBlockMesh:GetDescendants()) do
				if Fire:IsA("Fire") then
					Fire.Color = Color3.new(1,0,0)
				end
			end
			CurrentCodeString = ""
		end
		ActivateDoor()
		wait(1.5)
		for _, Fire in pairs(PassCodeDoor.ColorCodeBlockMesh:GetDescendants()) do
			if Fire:IsA("Fire") then
				Fire.Color = Color3.new(1,1,1)
			end
		end
	end
end)
local e = {}
1 Like

Why not invoke the server using a RemoteFunction and then returning true or false, true being access granted, false being access not granted? You could also pass the client’s argument to the server.

You could keep tweens and such client-sided while not revealing the passcode to exploiters.

Read up here:

2 Likes

Thank you! I would have never thought of that! I will do that

1 Like