--Fuction that plays when we click the button.

Button.MouseClick:Connect(function(player)
	local newcode = game.ReplicatedStorage:WaitForChild("CodeDoor"):InvokeClient(player)  --we invoke the players client and wait until they return the code

	if newcode == Code.Value then
		print('correct')
		Light.Color = Color3.fromRGB(73, 181, 71)					--Light (part) color changes
		Light.PointLight.Color = Color3.fromRGB(73, 181, 71)		--PointLight color changes (optional, disabled by default)							
		script.Parent.Parent.Lock.Disabled = false
		script.Parent.Button:Destroy()
	else 		--If the code is not correct, we just print "incorrect"
		print('incorrect') 
	end
end)


